Documentation
¶
Overview ¶
Package tf parses Terraform provider schemas (from "terraform providers schema -json") and converts them to gogen.ResourceSchema values for Go code generation.
Index ¶
- type Adapter
- func (a *Adapter) FetchConfiguration(ctx context.Context) (*gogen.ConfigurationSchema, error)
- func (a *Adapter) FetchDataSources(ctx context.Context, resources []string) ([]gogen.DataSourceSchema, error)
- func (a *Adapter) FetchResources(ctx context.Context, resources []string) ([]gogen.ResourceSchema, error)
- func (a *Adapter) Name() string
- type CLIFetcher
- type Fetcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct {
Fetcher Fetcher
// contains filtered or unexported fields
}
Adapter implements gogen.SchemaAdapter backed by TF provider schemas. provider is the fully-qualified TF registry source (e.g. "hashicorp/aws" or "ansible/ansible"). The part after the final slash becomes the local provider name for the terraform block and the Go package name.
func NewAdapter ¶
NewAdapter creates an Adapter for the given fully-qualified provider source. version is an optional TF version constraint (e.g. "~> 5.0").
func (*Adapter) FetchConfiguration ¶
FetchConfiguration extracts the TF provider's own configuration block (e.g. aws { region = ... }) and returns it as a generic schema for the renderer. A nil result means the provider declares no configuration attributes; the renderer then skips emitting a ProviderConfig struct and library Configuration entry.
func (*Adapter) FetchDataSources ¶
func (*Adapter) FetchResources ¶
type CLIFetcher ¶
type CLIFetcher struct{}
CLIFetcher runs terraform in a temp directory.