Documentation ¶
Overview ¶
Package terraform contains the utilities that's used for invoking terraform executable under the given directory with the given templates.
Index ¶
- Constants
- func Apply(dir string, platform string, stage Stage, terraformDir string, ...) error
- func Destroy(dir string, platform string, stage Stage, terraformDir string, ...) error
- func InitializeProvider(stages []Stage) infrastructure.Provider
- func Outputs(dir string, terraformDir string) ([]byte, error)
- func UnpackTerraform(dir string, stages []Stage) error
- type Provider
- func (p *Provider) DestroyBootstrap(ctx context.Context, dir string) error
- func (p *Provider) ExtractHostAddresses(dir string, config *types.InstallConfig, ha *infrastructure.HostAddresses) error
- func (p *Provider) Provision(_ context.Context, dir string, parents asset.Parents) ([]*asset.File, error)
- type Stage
Constants ¶
const StateFilename = "terraform.tfstate"
StateFilename is the default name of the terraform state file.
Variables ¶
This section is empty.
Functions ¶
func Apply ¶
func Apply(dir string, platform string, stage Stage, terraformDir string, extraOpts ...tfexec.ApplyOption) error
Apply unpacks the platform-specific Terraform modules into the given directory and then runs 'terraform init' and 'terraform apply'.
func Destroy ¶ added in v0.3.0
func Destroy(dir string, platform string, stage Stage, terraformDir string, extraOpts ...tfexec.DestroyOption) error
Destroy unpacks the platform-specific Terraform modules into the given directory and then runs 'terraform init' and 'terraform destroy'.
func InitializeProvider ¶ added in v0.9.153
func InitializeProvider(stages []Stage) infrastructure.Provider
InitializeProvider creates a concrete infrastructure.Provider for the given platform.
func Outputs ¶ added in v0.9.2
Outputs reads the terraform state file and returns the outputs of the stage as json.
func UnpackTerraform ¶ added in v0.9.2
UnpackTerraform unpacks the terraform binary and the specified provider binaries into the specified directory.
Types ¶
type Provider ¶ added in v0.9.153
type Provider struct {
// contains filtered or unexported fields
}
Provider implements the infrastructure.Provider interface.
func (*Provider) DestroyBootstrap ¶ added in v0.9.153
DestroyBootstrap implements pkg/infrastructure/provider.DestroyBootstrap. DestroyBootstrap iterates through each stage, and will run the destroy command when defined on a stage.
func (*Provider) ExtractHostAddresses ¶ added in v0.9.153
func (p *Provider) ExtractHostAddresses(dir string, config *types.InstallConfig, ha *infrastructure.HostAddresses) error
ExtractHostAddresses implements pkg/infrastructure/provider.ExtractHostAddresses. Extracts the addresses to be used for gathering debug logs by inspecting the Terraform output files.
func (*Provider) Provision ¶ added in v0.9.153
func (p *Provider) Provision(_ context.Context, dir string, parents asset.Parents) ([]*asset.File, error)
Provision implements pkg/infrastructure/provider.Provision. Provision iterates through each of the stages and applies the Terraform config for the stage.
type Stage ¶ added in v0.9.2
type Stage interface { // Name is the name of the stage. Name() string // Platform is the name of the platform. Platform() string // StateFilename is the name of the terraform state file. StateFilename() string // OutputsFilename is the name of the outputs file for the stage. OutputsFilename() string // Providers is the list of providers that are used for the stage. Providers() []providers.Provider // DestroyWithBootstrap is true if the stage should be destroyed when destroying the bootstrap resources. DestroyWithBootstrap() bool // Destroy destroys the resources created in the stage. This should only be called if the stage should be destroyed // when destroying the bootstrap resources. Destroy(directory string, terraformDir string, varFiles []string) error // ExtractHostAddresses extracts the IPs of the bootstrap and control plane machines. ExtractHostAddresses(directory string, config *types.InstallConfig) (bootstrap string, port int, masters []string, err error) // ExtractLBConfig extracts the LB DNS Names of the internal and external API LBs. ExtractLBConfig(directory string, terraformDir string, file *asset.File, tfvarsFile *asset.File) (ignition string, err error) }
Stage is an individual stage of terraform infrastructure provisioning.