Documentation
¶
Index ¶
- Constants
- func CreateConfigToBytes(opts CreateOptions) ([]byte, error)
- func Format(hcl []byte) []byte
- func ToModuleBlock(mc *ModuleConfig) (*block.Block, error)
- type Config
- type CreateOptions
- type ModuleConfig
- type ModuleOptions
- type Output
- type OutputOptions
- type ProviderOptions
- type TerraformOptions
- type VariableOptions
Constants ¶
View Source
const ( FileMain = "main.tf" FileVars = "terraform.tfvars" )
Variables ¶
This section is empty.
Functions ¶
func CreateConfigToBytes ¶
func CreateConfigToBytes(opts CreateOptions) ([]byte, error)
func ToModuleBlock ¶
func ToModuleBlock(mc *ModuleConfig) (*block.Block, error)
ToModuleBlock returns module block for the given module and variables.
Types ¶
type Config ¶
type Config struct {
// Attributes is the attributes of the Config.
// E.g.
// Attr1 = "xxx"
// attr2 = 1
// attr3 = true.
Attributes map[string]any
// Blocks blocks like terraform, provider, module, etc.
/**
terraform {
backend "http" {
xxx
}
xxx
}
provider "aws" {
region = "us-east-1"
}
module "aws" {
source = "xxx"
region = "us-east-1"
}
*/
Blocks block.Blocks
// contains filtered or unexported fields
}
Config handles the configuration of application to terraform config.
func NewConfig ¶
func NewConfig(opts CreateOptions) (*Config, error)
NewConfig returns a new Config.
type CreateOptions ¶
type CreateOptions struct {
Attributes map[string]any
TerraformOptions *TerraformOptions
ProviderOptions *ProviderOptions
ModuleOptions *ModuleOptions
VariableOptions *VariableOptions
OutputOptions OutputOptions
}
CreateOptions represents the CreateOptions of the Config.
type ModuleConfig ¶
type ModuleConfig struct {
// Name is the module name.
Name string
// Source is the module source.
Source string
// SchemaData is the data module schema.
SchemaData types.TemplateVersionSchemaData
// Attributes is the attributes of the module.
Attributes map[string]any
// Outputs is the module outputs.
Outputs []Output
}
ModuleConfig is a struct with model.Template and its variables.
type ModuleOptions ¶
type ModuleOptions struct {
// ModuleConfigs is the module configs of the deployment.
ModuleConfigs []*ModuleConfig
}
ModuleOptions is the options to create module blocks.
type OutputOptions ¶
type OutputOptions []Output
OutputOptions is the options to create outputs blocks.
type ProviderOptions ¶
type ProviderOptions struct {
// SecretMountPath is the mount path of the secret in the terraform config.
SecretMonthPath string
// ConnectorSeparator is the separator of the terraform provider alias name and id.
ConnectorSeparator string
// RequiredProviderNames is the required providers of the terraform config.
// E.g. ["kubernetes", "helm"].
RequiredProviderNames []string
Connectors model.Connectors
}
ProviderOptions is the options to create provider blocks.
type TerraformOptions ¶
type TerraformOptions struct {
// Token is the backend token to authenticate with the Seal Server of the terraform config.
Token string
// Address is the backend address of the terraform config.
Address string
// SkipTLSVerify is the backend cert verification of the terraform config.
SkipTLSVerify bool
// ProviderRequirements is the required providers of the terraform config.
ProviderRequirements map[string]*tfconfig.ProviderRequirement
}
TerraformOptions is the options to create terraform block.
type VariableOptions ¶
type VariableOptions struct {
// VariablePrefix is the prefix of the variable name.
VariablePrefix string
// ResourcePrefix is the prefix of the Walrus resource variable name.
ResourcePrefix string
// Variables is map with name in key and sensitive flag in value.
Variables map[string]bool
// DependencyOutputs is the map of the variable name and value.
DependencyOutputs map[string]parser.OutputState
}
VariableOptions is the options to create variables blocks.
Click to show internal directories.
Click to hide internal directories.