terraformworkspace

package
v0.0.0-...-7e26ddd Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAzurermBlobBackend

func NewAzurermBlobBackend(ctx context.Context, config TfStackConfig) interfaces.TerraformWorkspace

NewAzurermBlobBackend creates a new AzureBlobBackend instance.

func NewGCSBackend

func NewGCSBackend(ctx context.Context, config TfStackConfig) interfaces.TerraformWorkspace

NewGCSBackend creates a new GCSBackend instance.

func NewS3Backend

func NewS3Backend(ctx context.Context, config TfStackConfig) interfaces.TerraformWorkspace

NewS3Backend creates a new instance of the TerraformCloud struct.

func NewTerraformCloud

func NewTerraformCloud(ctx context.Context, config TfStackConfig) interfaces.TerraformWorkspace

NewTerraformCloud creates a new instance of the TerraformCloud struct.

Types

type AWSCredentials

type AWSCredentials struct {
	AWSAccessKeyID     string `json:"awsAccessKeyID"`
	AWSSecretKeyAccess string `json:"awsSecretAccessKey"`
	Token              string `json:"token"`
}

AWSCredentials is a struct that contains the AWS credentials for a specific workspace.

type AzureBackendBlock

type AzureBackendBlock struct {
	ResourceGroupName  string
	StorageAccountName string
	ContainerName      string
	Key                string
}

AzureBackendBlock is a struct representation of a terraform backend block for azurerm

type AzureBlobBackend

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

AzureBlobBackend is an implementation of the interfaces.TerraformWorkspace interface that uses Azure Blob Storage as the backend.

func (*AzureBlobBackend) DownloadWorkspaceState

func (b *AzureBlobBackend) DownloadWorkspaceState(ctx context.Context, workspaceToDirectory map[string]string) error

DownloadWorkspaceState downloads from the remote Azure Blob Storage backend the latest state file

func (*AzureBlobBackend) FindTerraformWorkspaces

func (b *AzureBlobBackend) FindTerraformWorkspaces(ctx context.Context) (map[string]string, error)

FindTerraformWorkspaces returns a map of Terraform workspace names to their respective directories.

type AzureCredentials

type AzureCredentials struct {
	AzureStorageAccountKey string `json:"azure_storage_account_key"`
}

AzureCredentials is a struct that holds the credentials for an Azure Blob Storage backend.

type Factory

type Factory struct{}

Factory is a struct that generates implementations of interfaces.TerraformWorkspace.

func (*Factory) Instantiate

func (f *Factory) Instantiate(ctx context.Context, environment string, tfConfig TfStackConfig) (interfaces.TerraformWorkspace, error)

Instantiate returns an implementation of the interfaces.TerraformWorkspace interface depending on the passed environment specification.

type GCSBackend

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

GCSBackend is an implementation of the interfaces.TerraformWorkspace interface that uses GCS as a backend.

func (*GCSBackend) DownloadWorkspaceState

func (b *GCSBackend) DownloadWorkspaceState(ctx context.Context, workspaceToDirectory map[string]string) error

DownloadWorkspaceState downloads from the remote Azure Blob Storage backend the latest state file

func (*GCSBackend) FindTerraformWorkspaces

func (b *GCSBackend) FindTerraformWorkspaces(ctx context.Context) (map[string]string, error)

FindTerraformWorkspaces returns a map of Terraform workspace names to their respective directories.

type GCSBackendBlock

type GCSBackendBlock struct {
	Bucket string
	Prefix string
}

GCSBackendBlock parses the backend block for GCS

type IsolatedTerraformWorkspace

type IsolatedTerraformWorkspace struct{}

IsolatedTerraformWorkspace is a struct that implements the interfaces.TerraformWorkspace interface for the purpose of end-to-end testing.

func NewIsolatedTerraformWorkspace

func NewIsolatedTerraformWorkspace() *IsolatedTerraformWorkspace

NewIsolatedTerraformWorkspace returns a new instance of IsolatedTerraformWorkspace

func (*IsolatedTerraformWorkspace) DownloadWorkspaceState

func (v *IsolatedTerraformWorkspace) DownloadWorkspaceState(_ context.Context, _ map[string]string) error

DownloadWorkspaceState downloads from the remote TerraformCloudFile backend the latest state file for each "workspace".

func (*IsolatedTerraformWorkspace) FindTerraformWorkspaces

func (v *IsolatedTerraformWorkspace) FindTerraformWorkspaces(_ context.Context) (map[string]string, error)

type S3Backend

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

func (*S3Backend) DownloadWorkspaceState

func (s *S3Backend) DownloadWorkspaceState(ctx context.Context, workspaceToDirectory map[string]string) error

DownloadWorkspaceState downloads from the remote S3 backend the latest state file for each "workspace".

func (*S3Backend) FindTerraformWorkspaces

func (s *S3Backend) FindTerraformWorkspaces(ctx context.Context) (map[string]string, error)

FindTerraformWorkspaces returns a map of TerraformCloudFile workspace names to their respective directories.

type S3BackendBlock

type S3BackendBlock struct {
	Bucket string
	Key    string
	Region string
}

S3BackendBlock is a struct representation of a terraform backend block for s3

type TerraformCloud

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

TerraformCloud is a struct that implements the interfaces.TerraformWorkspace interface.

func (*TerraformCloud) DownloadWorkspaceState

func (c *TerraformCloud) DownloadWorkspaceState(ctx context.Context, WorkspaceToDirectory map[string]string) error

DownloadWorkspaceState downloads from the remote TerraformCloudFile backend the latest state file for each "workspace".

func (*TerraformCloud) FindTerraformWorkspaces

func (c *TerraformCloud) FindTerraformWorkspaces(ctx context.Context) (map[string]string, error)

type TfStackConfig

type TfStackConfig struct {
	// Region is the region of that contains the state storage bucket (or container if Azure).
	Region string

	// CloudCredential is a cloud credential that is used to authenticate with a cloud provider. Credential should
	// only require read-only access.
	CloudCredential terraformValueObjects.Credential

	// StateBackend is the name of the backend used for storing State.
	StateBackend string

	// TerraformCloudOrganization is the name of the organization within TerraformCloudFile Cloud
	TerraformCloudOrganization string

	// TerraformCloudToken is the auth token to access TerraformCloudFile Cloud programmatically.
	TerraformCloudToken string

	// WorkspaceDirectories is a slice of directories that contains terraform workspaces within the user repo.
	WorkspaceDirectories WorkspaceDirectoriesDecoder
}

TfStackConfig is a struct containing the variables that define the Terraform operating environment (backend, workspaces, etc.).

type WorkspaceDirectoriesDecoder

type WorkspaceDirectoriesDecoder []string

func (*WorkspaceDirectoriesDecoder) Decode

func (d *WorkspaceDirectoriesDecoder) Decode(value string) error

Jump to

Keyboard shortcuts

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