Documentation
¶
Overview ¶
Package terragen provides a simple way to generate Go code from a terraform provider.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrPackageLocationNotEmpty = errors.New("providers pkg location is not empty") ErrProviderSchemaNotFound = errors.New("provider schema not found") )
Functions ¶
func GenerateGoCode ¶
func GenerateGoCode( args GenerateGoArgs, schemas *tfjson.ProviderSchemas, ) error
GenerateGoCode generates Go code for creating Terraform objects for the given providers and their schemas.
func GenerateProviderSchema ¶
Types ¶
type GenerateGoArgs ¶
type GenerateGoArgs struct { ProviderName string ProviderSource string ProviderVersion string // OutDir is the filesystem location where the generated files will be created. OutDir string // PkgPath is the Go pkg path to the generated files location, specified by OutDir. // E.g. if OutDir is in a module called "my-module" in a directory called "gen", // then the PkgPath should be "my-module/gen". PkgPath string // Force enables overriding any existing generated files per-provider. Force bool }
type Provider ¶
type Provider struct { Name string // Lack of cty tag means it is ignored Source string `cty:"source"` Version string `cty:"version"` }
Provider represents a single element of a map of required providers
func ParseProvider ¶
ParseProvider takes a provider as a string and returns a Provider object. An error is returned if the string could not be parsed. Example provider: aws=hashicorp/aws:4.60.0
type RequiredProviders ¶
RequiredProviders represents the map of required providers for a Terraform stack
type TerraformBlock ¶
type TerraformBlock struct {
RequiredProviders RequiredProviders `hcl:"required_providers,block"`
}
TerraformBlock represents a terraform{} block in a Terraform stack
type TerraformVersions ¶
type TerraformVersions struct {
TerraformBlock TerraformBlock `hcl:"terraform,block"`
}
TerraformVersions ...
Click to show internal directories.
Click to hide internal directories.