Skip to content

TerraformResource

laktory.models.TerraformResource ¤

Parent class for all Laktory models deployable with Terraform IaC backend.

PARAMETER DESCRIPTION
resource_name_

Name of the resource in the context of infrastructure as code. If None, default_resource_name will be used instead.

TYPE: str | VariableType DEFAULT: None

options

Resources options specifications

TYPE: ResourceOptions | VariableType DEFAULT: ResourceOptions(variables={}, is_enabled=True, depends_on=[], provider=None, ignore_changes=None, aliases=None, delete_before_replace=True, import_=None, parent=None, replace_on_changes=None, moved_from=None)

lookup_existing

Lookup resource instead of creating a new one.

TYPE: ResourceLookup | VariableType DEFAULT: None

ATTRIBUTE DESCRIPTION
core_resources

List of core resources to be deployed with this laktory model:

resource_key

Resource key used to build default resource name. Equivalent to

TYPE: str

resource_type_id

Resource type id used to build default resource name. Equivalent to

TYPE: str

self_as_core_resources

Flag set to True if self must be included in core resources

terraform_excludes

List of fields to exclude when dumping model to terraform

TYPE: Union[list[str], dict[str, bool]]

terraform_properties

Resources properties formatted for terraform:

TYPE: dict

terraform_renames

Map of fields to rename when dumping model to terraform

TYPE: dict[str, str]

core_resources property ¤

List of core resources to be deployed with this laktory model: - class instance (self)

resource_key property ¤

Resource key used to build default resource name. Equivalent to name properties if available. Otherwise, empty string.

resource_type_id property ¤

Resource type id used to build default resource name. Equivalent to class name converted to kebab case. e.g.: SecretScope -> secret-scope

self_as_core_resources property ¤

Flag set to True if self must be included in core resources

terraform_excludes property ¤

List of fields to exclude when dumping model to terraform

terraform_properties property ¤

Resources properties formatted for terraform:

  • Serialization (model dump)
  • Removal of excludes defined in self.terraform_excludes
  • Renaming of keys according to self.terraform_renames
  • Injection of variables
RETURNS DESCRIPTION
dict

Terraform-safe model dump

terraform_renames property ¤

Map of fields to rename when dumping model to terraform