terraform

package
v2.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2022 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetExecutable

func GetExecutable(ctx context.Context, workingDir string) (terraform *tfexec.Terraform, remove func(), err error)

GetExecutable returns a Terraform executable either from the local filesystem, or downloads the latest version fulfilling the version constraint.

Types

type AWSVariables added in v2.2.0

type AWSVariables struct {
	// CommonVariables contains common variables.
	CommonVariables
	// Region is the AWS region to use.
	Region string
	// Zone is the AWS zone to use in the given region.
	Zone string
	// AMIImageID is the ID of the AMI image to use.
	AMIImageID string
	// InstanceType is the type of the EC2 instance to use.
	InstanceType string
	// StateDiskType is the EBS disk type to use for the state disk.
	StateDiskType string
	// IAMGroupControlPlane is the IAM group to use for the control-plane nodes.
	IAMProfileControlPlane string
	// IAMGroupWorkerNodes is the IAM group to use for the worker nodes.
	IAMProfileWorkerNodes string
	// Debug is true if debug mode is enabled.
	Debug bool
}

GCPVariables is user configuration for creating a cluster with Terraform on GCP.

func (*AWSVariables) String added in v2.2.0

func (v *AWSVariables) String() string

type AzureVariables added in v2.2.0

type AzureVariables struct {
	// CommonVariables contains common variables.
	CommonVariables

	// ResourceGroup is the name of the Azure resource group to use.
	ResourceGroup string
	// Location is the Azure location to use.
	Location string
	// UserAssignedIdentity is the name of the Azure user-assigned identity to use.
	UserAssignedIdentity string
	// InstanceType is the Azure instance type to use.
	InstanceType string
	// StateDiskType is the Azure disk type to use for the state disk.
	StateDiskType string
	// ImageID is the ID of the Azure image to use.
	ImageID string
	// ConfidentialVM sets the VM to be confidential.
	ConfidentialVM bool
	// SecureBoot sets the VM to use secure boot.
	SecureBoot bool
	// Debug is true if debug mode is enabled.
	Debug bool
}

AzureVariables is user configuration for creating a cluster with Terraform on Azure.

func (*AzureVariables) String added in v2.2.0

func (v *AzureVariables) String() string

String returns a string representation of the variables, formatted as Terraform variables.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client manages interaction with Terraform.

func New

func New(ctx context.Context) (*Client, error)

New sets up a new Client for Terraform.

func (*Client) CleanUpWorkspace

func (c *Client) CleanUpWorkspace() error

CleanUpWorkspace removes terraform files from the current directory.

func (*Client) CreateCluster

func (c *Client) CreateCluster(
	ctx context.Context, provider cloudprovider.Provider, name string, vars Variables,
) (string, error)

CreateCluster creates a Constellation cluster using Terraform.

func (*Client) DestroyCluster

func (c *Client) DestroyCluster(ctx context.Context) error

DestroyInstances destroys a Constellation cluster using Terraform.

func (*Client) RemoveInstaller

func (c *Client) RemoveInstaller()

RemoveInstaller removes the Terraform installer, if it was downloaded for this command.

type CommonVariables

type CommonVariables struct {
	// Name of the cluster.
	Name string
	// CountControlPlanes is the number of control-plane nodes to create.
	CountControlPlanes int
	// CountWorkers is the number of worker nodes to create.
	CountWorkers int
	// StateDiskSizeGB is the size of the state disk to allocate to each node, in GB.
	StateDiskSizeGB int
}

CommonVariables is user configuration for creating a cluster with Terraform.

func (*CommonVariables) String

func (v *CommonVariables) String() string

String returns a string representation of the variables, formatted as Terraform variables.

type GCPVariables

type GCPVariables struct {
	// CommonVariables contains common variables.
	CommonVariables

	// Project is the ID of the GCP project to use.
	Project string
	// Region is the GCP region to use.
	Region string
	// Zone is the GCP zone to use.
	Zone string
	// CredentialsFile is the path to the GCP credentials file.
	CredentialsFile string
	// InstanceType is the GCP instance type to use.
	InstanceType string
	// StateDiskType is the GCP disk type to use for the state disk.
	StateDiskType string
	// ImageID is the ID of the GCP image to use.
	ImageID string
	// Debug is true if debug mode is enabled.
	Debug bool
}

GCPVariables is user configuration for creating a cluster with Terraform on GCP.

func (*GCPVariables) String

func (v *GCPVariables) String() string

String returns a string representation of the variables, formatted as Terraform variables.

type QEMUVariables

type QEMUVariables struct {
	// CommonVariables contains common variables.
	CommonVariables

	// LibvirtURI is the libvirt connection URI.
	LibvirtURI string
	// LibvirtSocketPath is the path to the libvirt socket in case of unix socket.
	LibvirtSocketPath string
	// CPUCount is the number of CPUs to allocate to each node.
	CPUCount int
	// MemorySizeMiB is the amount of memory to allocate to each node, in MiB.
	MemorySizeMiB int
	// IPRangeStart is the first IP address in the IP range to allocate to the cluster.
	ImagePath string
	// ImageFormat is the format of the image from ImagePath.
	ImageFormat string
	// MetadataAPIImage is the container image to use for the metadata API.
	MetadataAPIImage string
	// MetadataLibvirtURI is the libvirt connection URI used by the metadata container.
	// In case of unix socket, this should be "qemu:///system".
	// Other wise it should be the same as LibvirtURI.
	MetadataLibvirtURI string
	// NVRAM is the path to the NVRAM template.
	NVRAM string
	// Firmware is the path to the firmware.
	Firmware string
}

QEMUVariables is user configuration for creating a QEMU cluster with Terraform.

func (*QEMUVariables) String

func (v *QEMUVariables) String() string

String returns a string representation of the variables, formatted as Terraform variables.

type Variables

type Variables interface {
	fmt.Stringer
}

Variables is a struct that holds all variables that are passed to Terraform.

Jump to

Keyboard shortcuts

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