tfclient

package module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2021 License: MPL-2.0 Imports: 7 Imported by: 0

README

tf-client-sdk

Creates a Terraform client from a command and/or a RPC port. It's used to access a provider in a clean way.

import "github.com/clean8s/tf-client-sdk"
func main() {
    c := tfclient.MakeClient(exec.Command("tf-provider-example.exe"), nil)
    c.ReadResource(...)
}

Contains code from terraform/internal, owned by Hashicorp. Licensed under MPL. Derivative corresponding to version inversion.go.

It doesn't completely track upstream and the fork not be automatically synced with new TF versions until https://github.com/hashicorp/terraform-plugin-go becomes stable and the plugin protocol (v6?) is finalized.

Documentation

Index

Constants

View Source
const Header = "Terraform-Version"

Header is the header name used to send the current terraform version in http requests.

Variables

View Source
var Prerelease = ""

A pre-release marker for the version. If this is "" (empty string) then it means that it is a final release. Otherwise, this is a pre-release such as "dev" (in development), "beta", "rc1", etc.

SemVer is an instance of version.Version. This has the secondary benefit of verifying during tests and init time that our version is a proper semantic version, which should always be the case.

View Source
var TF_VERSION = Version
View Source
var Version = "1.0.6"

The main version number that is being run at the moment.

Functions

func MakeClient

func MakeClient(cmd *exec.Cmd, rc *goplug.ReattachConfig) *plugin.GRPCProvider

MakeClient creates a Terraform client from a command and/or a RPC port. It's used to access a provider in a clean way.

c := MakeClient(exec.Command("tf-provider-example.exe"), nil)
c.ReadResource(...)

func MakeClientConfig added in v1.0.1

func MakeClientConfig() *goplug.ClientConfig

MakeClientConfig creates a go-plugin ClientConfig object optimal for connecting to a provider.

func MakeClientCustom added in v1.0.1

func MakeClientCustom(config *goplug.ClientConfig) *plugin.GRPCProvider

MakeClientCustom acts like MakeClient except you can pass your custom ClientConfig. Use MakeClientConfig() for some defaults.

func String

func String() string

String returns the complete version string, including prerelease

Types

type ApplyResourceChangeRequest

type ApplyResourceChangeRequest = providers.ApplyResourceChangeRequest

type Attribute

type Attribute = configschema.Attribute

type Block

type Block = configschema.Block

type ConfigureProviderRequest

type ConfigureProviderRequest = providers.ConfigureProviderRequest

type GRPCProvider

type GRPCProvider = plugin.GRPCProvider

type NestedBlock

type NestedBlock = configschema.NestedBlock

type Object

type Object = configschema.Object

type PlanResourceChangeRequest

type PlanResourceChangeRequest = providers.PlanResourceChangeRequest

type ValidateProviderConfigRequest

type ValidateProviderConfigRequest = providers.ValidateProviderConfigRequest

type ValidateResourceConfigRequest

type ValidateResourceConfigRequest = providers.ValidateResourceConfigRequest

Directories

Path Synopsis
Package configschema contains types for describing the expected structure of a configuration block whose shape is not known until runtime.
Package configschema contains types for describing the expected structure of a configuration block whose shape is not known until runtime.
Package providers contains the interface and primary types required to implement a Terraform resource provider.
Package providers contains the interface and primary types required to implement a Terraform resource provider.
Package tfdiags is a utility package for representing errors and warnings in a manner that allows us to produce good messages for the user.
Package tfdiags is a utility package for representing errors and warnings in a manner that allows us to produce good messages for the user.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL