- Deny insecure transport — rejects any S3 API call made over plain HTTP
- Require latest TLS — rejects connections using TLS versions older than 1.2
"*") making requests against the bucket, including IAM users, roles, and AWS services.
Deny insecure transport
Settingattach_deny_insecure_transport_policy = true attaches a bucket policy that denies all s3:* actions when the request is not made over SSL.
The policy condition checks aws:SecureTransport = false and denies the request:
Require latest TLS
Settingattach_require_latest_tls_policy = true attaches a bucket policy that denies s3:* actions when the TLS version used by the client is less than 1.2.
The policy condition checks s3:TlsVersion < 1.2 and denies the request:
Variables
| Variable | Default | Description |
|---|---|---|
attach_deny_insecure_transport_policy | false | When true, attaches a bucket policy that denies all s3:* actions when aws:SecureTransport is false. |
attach_require_latest_tls_policy | false | When true, attaches a bucket policy that denies all s3:* actions when s3:TlsVersion is less than 1.2. |
Complete example
The following example creates a private bucket with both TLS enforcement policies enabled:How policies are applied
Policy documents are generated
When either
attach_deny_insecure_transport_policy or attach_require_latest_tls_policy is true, Terraform generates the corresponding aws_iam_policy_document data sources.Policies are merged into a combined document
Both policy documents are included in
data.aws_iam_policy_document.combined, which merges all active bucket policies (TLS, log delivery, encryption, custom, etc.) into a single JSON document.These policies are IAM resource-based bucket policies. They apply to all requestors regardless of their identity — including AWS service principals, IAM roles, and cross-account principals — whenever they interact with the bucket via the S3 API.

