tfhcl

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 14, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AttributeConfiguration

func AttributeConfiguration(configurations []Configuration) hclwrite.Tokens

func AttributeProviders

func AttributeProviders(providers map[string]string) hclwrite.Tokens

func BlockModule

func BlockModule(f *hclwrite.File, module_name string, providers map[string]string, source string, version string, attributes map[string]hclwrite.Tokens, configurations []Configuration)

func BlockProvider

func BlockProvider(f *hclwrite.File, cluster_provider string, alias string, region string)

func BlockTerraform

func BlockTerraform(f *hclwrite.File, providers map[string]map[string]string)

func BlockVariable

func BlockVariable(f *hclwrite.File, name string, tftype string, description string)

func ModuleCluster

func ModuleCluster(f *hclwrite.File, module_name string, cluster_provider string, cluster_name string, version string, configurations []Configuration)

func ModuleNodePool

func ModuleNodePool(f *hclwrite.File, module_name string, cluster_provider string, cluster_name string, version string, configurations []Configuration)

func ModuleService

func ModuleService(f *hclwrite.File, module_name string, cluster_name string, source string, version string, configurations []Configuration)

Types

type Backend

type Backend struct {
	Name string   `hcl:"name,label"`
	Body hcl.Body `hcl:",remain"`
}

type Blocks

type Blocks struct {
	Modules   []Module    `hcl:"module,block"`
	Providers []Provider  `hcl:"provider,block"`
	Variables []Variable  `hcl:"variable,block"`
	Terraform []Terraform `hcl:"terraform,block"`
	Locals    []Locals    `hcl:"locals,block"`

	// kubestack unused
	Resources   []Resource   `hcl:"resource,block"`
	DataSources []DataSource `hcl:"data,block"`
	Output      []Output     `hcl:"output,block"`
}

type Configuration

type Configuration struct {
	EnvironmentKey string
	Attributes     map[string]cty.Value
}

type DataSource

type DataSource struct {
	Type string   `hcl:"type,label"`
	Name string   `hcl:"name,label"`
	Body hcl.Body `hcl:",remain"`
}

type Locals

type Locals struct {
	Body hcl.Body `hcl:",remain"`
}

type Module

type Module struct {
	Name               string         `hcl:"name,label"`
	ProvidersRaw       hcl.Expression `hcl:"providers,optional"`
	Providers          map[string]Provider
	Source             string         `hcl:"source"`
	Version            string         `hcl:"version,optional"`
	ClusterNameRaw     hcl.Expression `hcl:"cluster_name,optional"`
	ClusterMetadataRaw hcl.Expression `hcl:"cluster_metadata,optional"`
	MetadataFQDNRaw    hcl.Expression `hcl:"metadata_fqdn,optional"`

	ConfigurationBaseKey string         `hcl:"configuration_base_key,optional"`
	ConfigurationRaw     hcl.Expression `hcl:"configuration"`
	Configuration        map[string]map[string]cty.Value
	Body                 hcl.Body `hcl:",remain"`
}

func (*Module) ConfigurationBaseKeyOrDefault

func (m *Module) ConfigurationBaseKeyOrDefault() string

func (*Module) NamePrefix

func (m *Module) NamePrefix() (region string, err error)

func (*Module) NodePoolName

func (m *Module) NodePoolName() (name string, err error)

func (*Module) ParentCluster

func (m *Module) ParentCluster() (string, error)

func (*Module) Region

func (m *Module) Region() (region string, err error)

func (*Module) TypeProviderVersion

func (m *Module) TypeProviderVersion() (t, p, v string, err error)

type Output

type Output struct {
	Name string   `hcl:"name,label"`
	Body hcl.Body `hcl:",remain"`
}

type Provider

type Provider struct {
	Name          string         `hcl:"name,label"`
	Alias         string         `hcl:"alias,optional"`
	Region        string         `hcl:"region,optional"`
	KubeconfigRaw hcl.Expression `hcl:"kubeconfig_raw,optional"`
	Body          hcl.Body       `hcl:",remain"`
}

type RequiredProvider

type RequiredProvider struct {
	Body hcl.Body `hcl:",remain"`
}

type Resource

type Resource struct {
	Type string   `hcl:"type,label"`
	Name string   `hcl:"name,label"`
	Body hcl.Body `hcl:",remain"`
}

type Root

type Root struct {
	Path   string
	Parser *hclparse.Parser

	Variables map[string][]Variable
	Modules   map[string][]Module
	Providers map[string][]Provider
	// contains filtered or unexported fields
}

func NewRoot

func NewRoot(path string) *Root

func (*Root) DeleteFiles

func (r *Root) DeleteFiles(paths []string) error

func (*Root) GetVariableValue

func (r *Root) GetVariableValue(name string) (value cty.Value, ok bool)

func (*Root) Read

func (r *Root) Read() (err error)

func (*Root) SetVariableValue

func (r *Root) SetVariableValue(name string, value cty.Value)

func (*Root) Write

func (r *Root) Write() (err error)

func (*Root) WriteFiles

func (r *Root) WriteFiles(data map[string][]byte) error

type Terraform

type Terraform struct {
	Backend           []Backend          `hcl:"backend,block"`
	RequiredProviders []RequiredProvider `hcl:"required_providers,block"`
	RequiredVersion   string             `hcl:"required_version,optional"`
}

type Variable

type Variable struct {
	Name        string         `hcl:"name,label"`
	Type        hcl.Expression `hcl:"type,optional"`
	Description string         `hcl:"description,optional"`
	Default     cty.Value      `hcl:"default,optional"`
	Body        hcl.Body       `hcl:",remain"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL