infrahouse_toolkit.terraform.backends package

Subpackages

Submodules

infrahouse_toolkit.terraform.backends.exceptions module

infrahouse_toolkit.terraform.backend exceptions.

exception infrahouse_toolkit.terraform.backends.exceptions.IHBackendException[source]

Bases: IHTFException

Terraform backend exceptions.

exception infrahouse_toolkit.terraform.backends.exceptions.IHUnknownBackend[source]

Bases: IHBackendException

Not supported Terraform backend.

infrahouse_toolkit.terraform.backends.s3backend module

Terraform S3 backend

class infrahouse_toolkit.terraform.backends.s3backend.TFS3Backend(bucket: str, key: str, region: str = None)[source]

Bases: TFBackend

TFS3Backend describes a Terraform state stored in AWS S3.

Parameters:
  • bucket (str) – AWS S3 bucket that stores the state.

  • key (str) – Path inside the S3 bucket to a file with the state. Something like path/to/github-control.state.

property bucket

S3 bucket name

property id

A backend URL that identifies the state file.

property key

Path to the Terraform state in the S3 bucket.

property region

AWS region. Taken from the environment variable AWS_DEFAULT_REGION if one is defined.

infrahouse_toolkit.terraform.backends.tfbackend module

Module for TFBackend. A generic class that defines the API for all kind of Terraform backends.

class infrahouse_toolkit.terraform.backends.tfbackend.TFBackend[source]

Bases: ABC

API to a Terraform backend.

abstract property id: str

A unique identifier of the Terraform backend.

Module contents

Module for various Terraform backends.

infrahouse_toolkit.terraform.backends.get_backend(backend_id: str) TFS3Backend[source]

Parse backend_id string and build a Terraform backend object based on the parsed values.

Parameters:

backend_id (str) – a straing that identifies a Terraform backend.

Returns:

Terraform backend object.

Return type:

Union[TFS3Backend, ]

Raises:

IHUnknownBackend – If parsing failed or the encoded backend is not supported