Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type General ¶
type General struct { Organisation string `yaml:"organisation,omitempty" json:"organisation,omitempty"` Workspace string `yaml:"workspace,omitempty" json:"workspace,omitempty"` TerraformVersion string `yaml:"terraformVersion" json:"terraformVersion" validate:"required"` Region string `yaml:"region" json:"region" validate:"required"` ProjectID string `yaml:"projectId" json:"projectId" validate:"required"` }
General contains general information about the terraform project. This information is used to generate the main.tf file. Organisation and Workspace are optional. If they are not provided, it will not connect to a remote state. TerraformVersion, Region and ProjectID are required.
type Module ¶
type Module struct { Name string `yaml:"name" json:"name" validate:"required"` GitOrganisation string `yaml:"organisation" json:"organisation" validate:"required"` Description string `yaml:"description,omitempty" json:"description,omitempty"` Version string `yaml:"version" json:"version" validate:"required"` }
Module contains information about the module. This information is used to generate the information across the module files. Name and Version are required. Description is optional.
type Service ¶
type Service struct { Name string `yaml:"name" json:"name" validate:"required"` Description string `yaml:"description,omitempty" json:"description,omitempty"` Modules []Module `yaml:"modules,omitempty" json:"modules,omitempty"` }
Service contains information about the service. This information is used to generate the information across the files. Name is required. Description and Modules is optional.
type Terraform ¶
type Terraform struct { General General `yaml:"general" json:"general"` Service Service `yaml:"service" json:"service"` }
Terraform is the struct that will be used to parse the terraform file. Should contain all the information needed to generate terraform code.
func Parse ¶
Parse will parse data into a Terraform struct. It will return an error if the file type is not supported. Currently only json and yaml is supported. It will also return an error if the data is not valid. The data is not valid if it does not match the Terraform struct validation rules.
func (*Terraform) Generate ¶
Generate will generate terraform files from the Terraform struct. It will return an error if the template cannot be read, parsed or executed. It will also return an error if the file cannot be created. The file will be created in the outputDir. Defaults to the current directory. The file name will be main.tf for the main file and <module_name>.tf for each module.