Interface S3BackendConfig
- All Superinterfaces:
software.amazon.jsii.JsiiSerializable
- All Known Subinterfaces:
DataTerraformRemoteStateS3Config
- All Known Implementing Classes:
DataTerraformRemoteStateS3Config.Jsii$Proxy
,S3BackendConfig.Jsii$Proxy
This backend also supports state locking and consistency checking via Dynamo DB, which can be enabled by setting the dynamodb_table field to an existing DynamoDB table name. A single DynamoDB table can be used to lock multiple remote state files. Terraform generates key names that include the values of the bucket and key variables.
Warning! It is highly recommended that you enable Bucket Versioning on the S3 bucket to allow for state recovery in the case of accidental deletions and human error.
Read more about this backend in the Terraform docs: https://developer.hashicorp.com/terraform/language/settings/backends/s3
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final class
A builder forS3BackendConfig
static final class
An implementation forS3BackendConfig
-
Method Summary
Modifier and TypeMethodDescriptionstatic S3BackendConfig.Builder
builder()
default String
(experimental) (Optional) AWS access key.default String
getAcl()
(experimental) (Optional) Canned ACL to be applied to the state file.(experimental) (Optional) List of allowed AWS account IDs to prevent potential destruction of a live environment.default S3BackendAssumeRoleConfig
(experimental) Assuming an IAM Role can be configured in two ways.default String
Deprecated.Use assumeRole.policy instead.Deprecated.Use assumeRole.policyArns instead.Deprecated.Use assumeRole.tags instead.Deprecated.Use assumeRole.transitiveTagKeys instead.(experimental) Assume Role With Web Identity Configuration.(experimental) Name of the S3 Bucket.default String
(experimental) (Optional) File containing custom root and intermediate certificates.default String
Deprecated.Use endpoints.dynamodb insteaddefault String
(experimental) (Optional) Name of DynamoDB Table to use for state locking and consistency.default String
(experimental) Optional) Custom endpoint URL for the EC2 Instance Metadata Service (IMDS) API.default String
(experimental) (Optional) Mode to use in communicating with the metadata service.default Boolean
(experimental) (Optional) Enable server side encryption of the state file.default String
Deprecated.Use endpoints.s3 insteaddefault S3BackendEndpointConfig
(experimental) (Optional) The endpoint configuration block.default String
Deprecated.Use assume_role.external_id instead.(experimental) (Optional) List of forbidden AWS account IDs to prevent potential destruction of a live environment.default Boolean
Deprecated.Use usePathStyle insteaddefault String
(experimental) (Optional) URL of a proxy to use for HTTP requests when accessing the AWS API.default String
(experimental) (Optional) URL of a proxy to use for HTTPS requests when accessing the AWS API.default String
Deprecated.Use endpoints.iam insteaddefault Boolean
(experimental) Optional) Whether to explicitly allow the backend to perform "insecure" SSL requests.getKey()
(experimental) Path to the state file inside the S3 Bucket.default String
(experimental) (Optional) Amazon Resource Name (ARN) of a Key Management Service (KMS) Key to use for encrypting the state.default Number
(experimental) (Optional) The maximum number of times an AWS API request is retried on retryable failure.default String
(experimental) (Optional) Comma-separated list of hosts that should not use HTTP or HTTPS proxies.default String
(experimental) (Optional) Name of AWS profile in AWS shared credentials file (e.g.default String
(experimental) AWS Region of the S3 Bucket and DynamoDB Table (if used).default String
(experimental) (Optional) Specifies how retries are attempted.default String
Deprecated.Use assumeRole.roleArn instead.default String
(experimental) (Optional) AWS secret access key.default String
Deprecated.Use assumeRole.sessionName instead.(experimental) (Optional) List of paths to AWS shared configuration files.default String
(experimental) (Optional) Path to the AWS shared credentials file.(experimental) (Optional) List of paths to AWS shared credentials files.default Boolean
(experimental) (Optional) Skip credentials validation via the STS API.default Boolean
(experimental) (Optional) Skip usage of EC2 Metadata API.default Boolean
(experimental) (Optional) Skip validation of provided region name.default Boolean
(experimental) (Optional) Whether to skip requesting the account ID.default Boolean
(experimental) (Optional) Do not include checksum when uploading S3 Objects.default String
(experimental) (Optional) The key to use for encrypting state with Server-Side Encryption with Customer-Provided Keys (SSE-C).default String
Deprecated.Use endpoints.sts insteaddefault String
(experimental) (Optional) AWS region for STS.default String
getToken()
(experimental) (Optional) Multi-Factor Authentication (MFA) token.default Boolean
(experimental) (Optional) Use the legacy authentication workflow, preferring environment variables over backend configuration.default Boolean
(experimental) (Optional) Enable path-style S3 URLs (https:/// instead of https:// . ). default String
(experimental) (Optional) Prefix applied to the state path inside the bucket.Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getBucket
(experimental) Name of the S3 Bucket. -
getKey
(experimental) 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
-
getAccessKey
(experimental) (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).
-
getAcl
(experimental) (Optional) Canned ACL to be applied to the state file. -
getAllowedAccountIds
(experimental) (Optional) List of allowed AWS account IDs to prevent potential destruction of a live environment.Conflicts with forbidden_account_ids.
-
getAssumeRole
(experimental) 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.
-
getAssumeRolePolicy
Deprecated.Use assumeRole.policy instead.(deprecated) (Optional) IAM Policy JSON describing further restricting permissions for the IAM Role being assumed. -
getAssumeRolePolicyArns
Deprecated.Use assumeRole.policyArns instead.(deprecated) (Optional) Set of Amazon Resource Names (ARNs) of IAM Policies describing further restricting permissions for the IAM Role being assumed. -
getAssumeRoleTags
Deprecated.Use assumeRole.tags instead.(deprecated) (Optional) Map of assume role session tags. -
getAssumeRoleTransitiveTagKeys
Deprecated.Use assumeRole.transitiveTagKeys instead.(deprecated) (Optional) Set of assume role session tag keys to pass to any subsequent sessions. -
getAssumeRoleWithWebIdentity
@Stability(Experimental) @Nullable default S3BackendAssumeRoleWithWebIdentityConfig getAssumeRoleWithWebIdentity()(experimental) Assume Role With Web Identity Configuration. -
getCustomCaBundle
(experimental) (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.
-
getDynamodbEndpoint
Deprecated.Use endpoints.dynamodb instead(deprecated) (Optional) Custom endpoint for the AWS DynamoDB API.This can also be sourced from the AWS_DYNAMODB_ENDPOINT environment variable.
-
getDynamodbTable
(experimental) (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.
-
getEc2MetadataServiceEndpoint
(experimental) 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.
-
getEc2MetadataServiceEndpointMode
(experimental) (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.
-
getEncrypt
(experimental) (Optional) Enable server side encryption of the state file. -
getEndpoint
Deprecated.Use endpoints.s3 instead(deprecated) (Optional) Custom endpoint for the AWS S3 API.This can also be sourced from the AWS_S3_ENDPOINT environment variable.
-
getEndpoints
(experimental) (Optional) The endpoint configuration block. -
getExternalId
Deprecated.Use assume_role.external_id instead.(deprecated) (Optional) External identifier to use when assuming the role. -
getForbiddenAccountIds
(experimental) (Optional) List of forbidden AWS account IDs to prevent potential destruction of a live environment.Conflicts with allowed_account_ids.
-
getForcePathStyle
Deprecated.Use usePathStyle instead(deprecated) (Optional) Enable path-style S3 URLs (https:/// instead of https:// . ). -
getHttpProxy
(experimental) (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.
-
getHttpsProxy
(experimental) (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.
-
getIamEndpoint
Deprecated.Use endpoints.iam instead(deprecated) (Optional) Custom endpoint for the AWS Identity and Access Management (IAM) API.This can also be sourced from the AWS_IAM_ENDPOINT environment variable.
-
getInsecure
(experimental) Optional) Whether to explicitly allow the backend to perform "insecure" SSL requests.If omitted, the default value is false.
-
getKmsKeyId
(experimental) (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.
-
getMaxRetries
(experimental) (Optional) The maximum number of times an AWS API request is retried on retryable failure.Defaults to 5.
-
getNoProxy
(experimental) (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.
-
getProfile
(experimental) (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. -
getRegion
(experimental) 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.
-
getRetryMode
(experimental) (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.
-
getRoleArn
Deprecated.Use assumeRole.roleArn instead.(deprecated) (Optional) Amazon Resource Name (ARN) of the IAM Role to assume. -
getSecretKey
(experimental) (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)
-
getSessionName
Deprecated.Use assumeRole.sessionName instead.(deprecated) (Optional) Session name to use when assuming the role. -
getSkipCredentialsValidation
(experimental) (Optional) Skip credentials validation via the STS API. -
getSkipMetadataApiCheck
(experimental) (Optional) Skip usage of EC2 Metadata API. -
getSkipRegionValidation
(experimental) (Optional) Skip validation of provided region name. -
getSkipRequestingAccountId
(experimental) (Optional) Whether to skip requesting the account ID.Useful for AWS API implementations that do not have the IAM, STS API, or metadata API.
-
getSkipS3Checksum
(experimental) (Optional) Do not include checksum when uploading S3 Objects.Useful for some S3-Compatible APIs.
-
getSseCustomerKey
(experimental) (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.
-
getStsEndpoint
Deprecated.Use endpoints.sts instead(deprecated) (Optional) Custom endpoint for the AWS Security Token Service (STS) API.This can also be sourced from the AWS_STS_ENDPOINT environment variable.
-
getStsRegion
(experimental) (Optional) AWS region for STS.If unset, AWS will use the same region for STS as other non-STS operations.
-
getToken
(experimental) (Optional) Multi-Factor Authentication (MFA) token.This can also be sourced from the AWS_SESSION_TOKEN environment variable.
-
getUseLegacyWorkflow
(experimental) (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.
-
getUsePathStyle
(experimental) (Optional) Enable path-style S3 URLs (https:/// instead of https:// . ). -
getWorkspaceKeyPrefix
(experimental) (Optional) Prefix applied to the state path inside the bucket.This is only relevant when using a non-default workspace. Defaults to env:
-
builder
- Returns:
- a
S3BackendConfig.Builder
ofS3BackendConfig
-