Skip to main content

Initializers

import cdktn

cdktn.S3Backend(
  scope: Construct,
  bucket: str,
  key: str,
  access_key: str = None,
  acl: str = None,
  allowed_account_ids: typing.List[str] = None,
  assume_role: S3BackendAssumeRoleConfig = None,
  assume_role_policy: str = None,
  assume_role_policy_arns: typing.List[str] = None,
  assume_role_tags: typing.Mapping[str] = None,
  assume_role_transitive_tag_keys: typing.List[str] = None,
  assume_role_with_web_identity: S3BackendAssumeRoleWithWebIdentityConfig = None,
  custom_ca_bundle: str = None,
  dynamodb_endpoint: str = None,
  dynamodb_table: str = None,
  ec2_metadata_service_endpoint: str = None,
  ec2_metadata_service_endpoint_mode: str = None,
  encrypt: bool = None,
  endpoint: str = None,
  endpoints: S3BackendEndpointConfig = None,
  external_id: str = None,
  forbidden_account_ids: typing.List[str] = None,
  force_path_style: bool = None,
  http_proxy: str = None,
  https_proxy: str = None,
  iam_endpoint: str = None,
  insecure: bool = None,
  kms_key_id: str = None,
  max_retries: typing.Union[int, float] = None,
  no_proxy: str = None,
  profile: str = None,
  region: str = None,
  retry_mode: str = None,
  role_arn: str = None,
  secret_key: str = None,
  session_name: str = None,
  shared_config_files: typing.List[str] = None,
  shared_credentials_file: str = None,
  shared_credentials_files: typing.List[str] = None,
  skip_credentials_validation: bool = None,
  skip_metadata_api_check: bool = None,
  skip_region_validation: bool = None,
  skip_requesting_account_id: bool = None,
  skip_s3_checksum: bool = None,
  sse_customer_key: str = None,
  sts_endpoint: str = None,
  sts_region: str = None,
  token: str = None,
  use_legacy_workflow: bool = None,
  use_path_style: bool = None,
  workspace_key_prefix: str = None
)
NameTypeDescription
scopeconstructs.ConstructNo description.
bucketstrName of the S3 Bucket.
keystrPath to the state file inside the S3 Bucket.
access_keystr(Optional) AWS access key.
aclstr(Optional) Canned ACL to be applied to the state file.
allowed_account_idstyping.List[str](Optional) List of allowed AWS account IDs to prevent potential destruction of a live environment.
assume_roleS3BackendAssumeRoleConfigAssuming an IAM Role can be configured in two ways.
assume_role_policystr(Optional) IAM Policy JSON describing further restricting permissions for the IAM Role being assumed.
assume_role_policy_arnstyping.List[str](Optional) Set of Amazon Resource Names (ARNs) of IAM Policies describing further restricting permissions for the IAM Role being assumed.
assume_role_tagstyping.Mapping[str](Optional) Map of assume role session tags.
assume_role_transitive_tag_keystyping.List[str](Optional) Set of assume role session tag keys to pass to any subsequent sessions.
assume_role_with_web_identityS3BackendAssumeRoleWithWebIdentityConfigAssume Role With Web Identity Configuration.
custom_ca_bundlestr(Optional) File containing custom root and intermediate certificates.
dynamodb_endpointstr(Optional) Custom endpoint for the AWS DynamoDB API.
dynamodb_tablestr(Optional) Name of DynamoDB Table to use for state locking and consistency.
ec2_metadata_service_endpointstrOptional) Custom endpoint URL for the EC2 Instance Metadata Service (IMDS) API.
ec2_metadata_service_endpoint_modestr(Optional) Mode to use in communicating with the metadata service.
encryptbool(Optional) Enable server side encryption of the state file.
endpointstr(Optional) Custom endpoint for the AWS S3 API.
endpointsS3BackendEndpointConfig(Optional) The endpoint configuration block.
external_idstr(Optional) External identifier to use when assuming the role.
forbidden_account_idstyping.List[str](Optional) List of forbidden AWS account IDs to prevent potential destruction of a live environment.
force_path_stylebool(Optional) Enable path-style S3 URLs (https://< HOST >/< BUCKET > instead of https://< BUCKET >.< HOST >).
http_proxystr(Optional) URL of a proxy to use for HTTP requests when accessing the AWS API.
https_proxystr(Optional) URL of a proxy to use for HTTPS requests when accessing the AWS API.
iam_endpointstr(Optional) Custom endpoint for the AWS Identity and Access Management (IAM) API.
insecureboolOptional) Whether to explicitly allow the backend to perform “insecure” SSL requests.
kms_key_idstr(Optional) Amazon Resource Name (ARN) of a Key Management Service (KMS) Key to use for encrypting the state.
max_retriestyping.Union[int, float](Optional) The maximum number of times an AWS API request is retried on retryable failure.
no_proxystr(Optional) Comma-separated list of hosts that should not use HTTP or HTTPS proxies.
profilestr(Optional) Name of AWS profile in AWS shared credentials file (e.g. ~/.aws/credentials) or AWS shared configuration file (e.g. ~/.aws/config) to use for credentials and/or configuration. This can also be sourced from the AWS_PROFILE environment variable.
regionstrAWS Region of the S3 Bucket and DynamoDB Table (if used).
retry_modestr(Optional) Specifies how retries are attempted.
role_arnstr(Optional) Amazon Resource Name (ARN) of the IAM Role to assume.
secret_keystr(Optional) AWS secret access key.
session_namestr(Optional) Session name to use when assuming the role.
shared_config_filestyping.List[str](Optional) List of paths to AWS shared configuration files.
shared_credentials_filestr(Optional) Path to the AWS shared credentials file.
shared_credentials_filestyping.List[str](Optional) List of paths to AWS shared credentials files.
skip_credentials_validationbool(Optional) Skip credentials validation via the STS API.
skip_metadata_api_checkbool(Optional) Skip usage of EC2 Metadata API.
skip_region_validationbool(Optional) Skip validation of provided region name.
skip_requesting_account_idbool(Optional) Whether to skip requesting the account ID.
skip_s3_checksumbool(Optional) Do not include checksum when uploading S3 Objects.
sse_customer_keystr(Optional) The key to use for encrypting state with Server-Side Encryption with Customer-Provided Keys (SSE-C).
sts_endpointstr(Optional) Custom endpoint for the AWS Security Token Service (STS) API.
sts_regionstr(Optional) AWS region for STS.
tokenstr(Optional) Multi-Factor Authentication (MFA) token.
use_legacy_workflowbool(Optional) Use the legacy authentication workflow, preferring environment variables over backend configuration.
use_path_stylebool(Optional) Enable path-style S3 URLs (https://< HOST >/< BUCKET > instead of https://< BUCKET >.< HOST >).
workspace_key_prefixstr(Optional) Prefix applied to the state path inside the bucket.

scopeRequired

  • Type: constructs.Construct

bucketRequired

  • Type: str
Name of the S3 Bucket.

keyRequired

  • Type: str
Path to the state file inside the S3 Bucket. When using a non-default workspace, the state path will be /workspace_key_prefix/workspace_name/key

access_keyOptional

  • Type: str
(Optional) AWS access key. If configured, must also configure secret_key. This can also be sourced from the AWS_ACCESS_KEY_ID environment variable, AWS shared credentials file (e.g. ~/.aws/credentials), or AWS shared configuration file (e.g. ~/.aws/config).

aclOptional

  • Type: str
(Optional) Canned ACL to be applied to the state file.

allowed_account_idsOptional

  • Type: typing.List[str]
(Optional) List of allowed AWS account IDs to prevent potential destruction of a live environment. Conflicts with forbidden_account_ids.

assume_roleOptional

Assuming an IAM Role can be configured in two ways. The preferred way is to use the argument assume_role, the other, which is deprecated, is with arguments at the top level.

assume_role_policyOptional

  • Deprecated: Use assumeRole.policy instead.
  • Type: str
(Optional) IAM Policy JSON describing further restricting permissions for the IAM Role being assumed.

assume_role_policy_arnsOptional

  • Deprecated: Use assumeRole.policyArns instead.
  • Type: typing.List[str]
(Optional) Set of Amazon Resource Names (ARNs) of IAM Policies describing further restricting permissions for the IAM Role being assumed.

assume_role_tagsOptional

  • Deprecated: Use assumeRole.tags instead.
  • Type: typing.Mapping[str]
(Optional) Map of assume role session tags.

assume_role_transitive_tag_keysOptional

  • Deprecated: Use assumeRole.transitiveTagKeys instead.
  • Type: typing.List[str]
(Optional) Set of assume role session tag keys to pass to any subsequent sessions.

assume_role_with_web_identityOptional

Assume Role With Web Identity Configuration.

custom_ca_bundleOptional

  • Type: str
(Optional) File containing custom root and intermediate certificates. Can also be set using the AWS_CA_BUNDLE environment variable. Setting ca_bundle in the shared config file is not supported.

dynamodb_endpointOptional

  • Deprecated: Use endpoints.dynamodb instead
  • Type: str
(Optional) Custom endpoint for the AWS DynamoDB API. This can also be sourced from the AWS_DYNAMODB_ENDPOINT environment variable.

dynamodb_tableOptional

  • Type: str
(Optional) Name of DynamoDB Table to use for state locking and consistency. The table must have a partition key named LockID with type of String. If not configured, state locking will be disabled.

ec2_metadata_service_endpointOptional

  • Type: str
Optional) Custom endpoint URL for the EC2 Instance Metadata Service (IMDS) API. Can also be set with the AWS_EC2_METADATA_SERVICE_ENDPOINT environment variable.

ec2_metadata_service_endpoint_modeOptional

  • Type: str
(Optional) Mode to use in communicating with the metadata service. Valid values are IPv4 and IPv6. Can also be set with the AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE environment variable.

encryptOptional

  • Type: bool
(Optional) Enable server side encryption of the state file.

endpointOptional

  • Deprecated: Use endpoints.s3 instead
  • Type: str
(Optional) Custom endpoint for the AWS S3 API. This can also be sourced from the AWS_S3_ENDPOINT environment variable.

endpointsOptional

(Optional) The endpoint configuration block.

external_idOptional

  • Deprecated: Use assume_role.external_id instead.
  • Type: str
(Optional) External identifier to use when assuming the role.

forbidden_account_idsOptional

  • Type: typing.List[str]
(Optional) List of forbidden AWS account IDs to prevent potential destruction of a live environment. Conflicts with allowed_account_ids.

force_path_styleOptional

  • Deprecated: Use usePathStyle instead
  • Type: bool
(Optional) Enable path-style S3 URLs (https://< HOST >/< BUCKET > instead of https://< BUCKET >.< HOST >).

http_proxyOptional

  • Type: str
(Optional) URL of a proxy to use for HTTP requests when accessing the AWS API. Can also be set using the HTTP_PROXY or http_proxy environment variables.

https_proxyOptional

  • Type: str
(Optional) URL of a proxy to use for HTTPS requests when accessing the AWS API. Can also be set using the HTTPS_PROXY or https_proxy environment variables.

iam_endpointOptional

  • Deprecated: Use endpoints.iam instead
  • Type: str
(Optional) Custom endpoint for the AWS Identity and Access Management (IAM) API. This can also be sourced from the AWS_IAM_ENDPOINT environment variable.

insecureOptional

  • Type: bool
Optional) Whether to explicitly allow the backend to perform “insecure” SSL requests. If omitted, the default value is false.

kms_key_idOptional

  • Type: str
(Optional) Amazon Resource Name (ARN) of a Key Management Service (KMS) Key to use for encrypting the state. Note that if this value is specified, Terraform will need kms:Encrypt, kms:Decrypt and kms:GenerateDataKey permissions on this KMS key.

max_retriesOptional

  • Type: typing.Union[int, float]
(Optional) The maximum number of times an AWS API request is retried on retryable failure. Defaults to 5.

no_proxyOptional

  • Type: str
(Optional) Comma-separated list of hosts that should not use HTTP or HTTPS proxies. Each value can be one of:
  • A domain name
  • An IP address
  • A CIDR address
  • An asterisk (*), to indicate that no proxying should be performed Domain name and IP address values can also include a port number. Can also be set using the NO_PROXY or no_proxy environment variables.

profileOptional

  • Type: str
(Optional) Name of AWS profile in AWS shared credentials file (e.g. ~/.aws/credentials) or AWS shared configuration file (e.g. ~/.aws/config) to use for credentials and/or configuration. This can also be sourced from the AWS_PROFILE environment variable.

regionOptional

  • Type: str
AWS Region of the S3 Bucket and DynamoDB Table (if used). This can also be sourced from the AWS_DEFAULT_REGION and AWS_REGION environment variables.

retry_modeOptional

  • Type: str
(Optional) Specifies how retries are attempted. Valid values are standard and adaptive. Can also be configured using the AWS_RETRY_MODE environment variable or the shared config file parameter retry_mode.

role_arnOptional

  • Deprecated: Use assumeRole.roleArn instead.
  • Type: str
(Optional) Amazon Resource Name (ARN) of the IAM Role to assume.

secret_keyOptional

  • Type: str
(Optional) AWS secret access key. If configured, must also configure access_key. This can also be sourced from the AWS_SECRET_ACCESS_KEY environment variable, AWS shared credentials file (e.g. ~/.aws/credentials), or AWS shared configuration file (e.g. ~/.aws/config)

session_nameOptional

  • Deprecated: Use assumeRole.sessionName instead.
  • Type: str
(Optional) Session name to use when assuming the role.

shared_config_filesOptional

  • Type: typing.List[str]
(Optional) List of paths to AWS shared configuration files. Defaults to ~/.aws/config.

shared_credentials_fileOptional

  • Type: str
(Optional) Path to the AWS shared credentials file. Defaults to ~/.aws/credentials.

shared_credentials_filesOptional

  • Type: typing.List[str]
(Optional) List of paths to AWS shared credentials files. Defaults to ~/.aws/credentials.

skip_credentials_validationOptional

  • Type: bool
(Optional) Skip credentials validation via the STS API.

skip_metadata_api_checkOptional

  • Type: bool
(Optional) Skip usage of EC2 Metadata API.

skip_region_validationOptional

  • Type: bool
(Optional) Skip validation of provided region name.

skip_requesting_account_idOptional

  • Type: bool
(Optional) Whether to skip requesting the account ID. Useful for AWS API implementations that do not have the IAM, STS API, or metadata API.

skip_s3_checksumOptional

  • Type: bool
(Optional) Do not include checksum when uploading S3 Objects. Useful for some S3-Compatible APIs.

sse_customer_keyOptional

  • Type: str
(Optional) The key to use for encrypting state with Server-Side Encryption with Customer-Provided Keys (SSE-C). This is the base64-encoded value of the key, which must decode to 256 bits. This can also be sourced from the AWS_SSE_CUSTOMER_KEY environment variable, which is recommended due to the sensitivity of the value. Setting it inside a terraform file will cause it to be persisted to disk in terraform.tfstate.

sts_endpointOptional

  • Deprecated: Use endpoints.sts instead
  • Type: str
(Optional) Custom endpoint for the AWS Security Token Service (STS) API. This can also be sourced from the AWS_STS_ENDPOINT environment variable.

sts_regionOptional

  • Type: str
(Optional) AWS region for STS. If unset, AWS will use the same region for STS as other non-STS operations.

tokenOptional

  • Type: str
(Optional) Multi-Factor Authentication (MFA) token. This can also be sourced from the AWS_SESSION_TOKEN environment variable.

use_legacy_workflowOptional

  • Type: bool
(Optional) Use the legacy authentication workflow, preferring environment variables over backend configuration. Defaults to true. This behavior does not align with the authentication flow of the AWS CLI or SDK’s, and will be removed in the future.

use_path_styleOptional

  • Type: bool
(Optional) Enable path-style S3 URLs (https://< HOST >/< BUCKET > instead of https://< BUCKET >.< HOST >).

workspace_key_prefixOptional

  • Type: str
(Optional) Prefix applied to the state path inside the bucket. This is only relevant when using a non-default workspace. Defaults to env:

Methods

NameDescription
to_stringReturns a string representation of this construct.
add_overrideNo description.
override_logical_idOverrides the auto-generated logical ID with a specific ID.
reset_override_logical_idResets a previously passed logical Id to use the auto-generated logical id again.
to_hcl_terraformNo description.
to_metadataNo description.
to_terraformAdds this resource to the terraform JSON output.
get_remote_state_data_sourceCreates a TerraformRemoteState resource that accesses this backend.

to_string

def to_string() -> str
Returns a string representation of this construct.

add_override

def add_override(
  path: str,
  value: typing.Any
) -> None

pathRequired

  • Type: str

valueRequired

  • Type: typing.Any

override_logical_id

def override_logical_id(
  new_logical_id: str
) -> None
Overrides the auto-generated logical ID with a specific ID.

new_logical_idRequired

  • Type: str
The new logical ID to use for this stack element.

reset_override_logical_id

def reset_override_logical_id() -> None
Resets a previously passed logical Id to use the auto-generated logical id again.

to_hcl_terraform

def to_hcl_terraform() -> typing.Any

to_metadata

def to_metadata() -> typing.Any

to_terraform

def to_terraform() -> typing.Any
Adds this resource to the terraform JSON output.

get_remote_state_data_source

def get_remote_state_data_source(
  scope: Construct,
  name: str,
  _fromstack: str
) -> TerraformRemoteState
Creates a TerraformRemoteState resource that accesses this backend.

scopeRequired

  • Type: constructs.Construct

nameRequired

  • Type: str

_fromstackRequired

  • Type: str

Static Functions

NameDescription
is_constructChecks if x is a construct.
is_terraform_elementNo description.
is_backendNo description.

is_construct

import cdktn

cdktn.S3Backend.is_construct(
  x: typing.Any
)
Checks if x is a construct. Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked. Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired

  • Type: typing.Any
Any object.

is_terraform_element

import cdktn

cdktn.S3Backend.is_terraform_element(
  x: typing.Any
)

xRequired

  • Type: typing.Any

is_backend

import cdktn

cdktn.S3Backend.is_backend(
  x: typing.Any
)

xRequired

  • Type: typing.Any

Properties

NameTypeDescription
nodeconstructs.NodeThe tree node.
cdktf_stackTerraformStackNo description.
fqnstrNo description.
friendly_unique_idstrNo description.

nodeRequired

node: Node
  • Type: constructs.Node
The tree node.

cdktf_stackRequired

cdktf_stack: TerraformStack

fqnRequired

fqn: str
  • Type: str

friendly_unique_idRequired

friendly_unique_id: str
  • Type: str