We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example Implementation writing a foo = {} assignment
foo = {}
Example Implementation writing a provider "foo" {} block
provider "foo" {}
Usage in go templates:
terraform { required_version = "={{ .TerraformVersion }}" {{ template "backend" .Backend }} required_providers { {{- range $k, $v := .ProviderVersions }} {{ toHclAssignment $k $v }} {{- end }} } }
Result:
terraform { required_version = "=1.5.7" backend "s3" { # snip ... } required_providers { archive = { source = "hashicorp/archive" version = "~> 2.0" } assert = { source = "bwoznicki/assert" version = "0.0.1" } ...
Caveat: requires json tags on the golang structs as zclconf/go-cty only supports UnmarshalJSON // json tags required for toHCLAssignment function // in util/template.go type ProviderVersion struct { Source string `yaml:"source" json:"source"` Version *string `yaml:"version" json:"version"` }
Caveat: requires json tags on the golang structs as zclconf/go-cty only supports UnmarshalJSON
json
zclconf/go-cty
// json tags required for toHCLAssignment function // in util/template.go type ProviderVersion struct { Source string `yaml:"source" json:"source"` Version *string `yaml:"version" json:"version"` }
Inspiration from:
The text was updated successfully, but these errors were encountered:
Just noticed github.com/zclconf/go-cty-yaml - may not need json tags 🤦♂️
Sorry, something went wrong.
No branches or pull requests
Example Implementation writing a
foo = {}
assignmentExample Implementation writing a
provider "foo" {}
blockUsage in go templates:
Result:
Inspiration from:
The text was updated successfully, but these errors were encountered: