S3Backend class final
terraform { backend "s3" { ... } } configuration.
Covers S3 itself and the S3-compatible stores people actually keep
Terraform state in — Cloudflare R2, MinIO, Backblaze B2. Those need
a custom endpoints entry plus some subset of the skip_* flags,
because the AWS SDK preflight calls they suppress do not exist
outside AWS. S3Backend.r2 fills all of it in for R2.
Every optional field is omitted from toTfJson when null, so the
Terraform-side default applies rather than a value terradart chose.
An explicit false is a value, and is emitted. bucket and key are
optional for the same reason as GcsBackend's: a partial
configuration leaves them to terraform init -backend-config.
- Implemented types
- Annotations
-
- @immutable
Constructors
-
S3Backend({String? bucket, String? key, String? region, Map<
String, String> ? endpoints, bool? usePathStyle, bool? skipCredentialsValidation, bool? skipRegionValidation, bool? skipRequestingAccountId, bool? skipMetadataApiCheck, bool? skipS3Checksum}) -
const
- S3Backend.r2({required String accountId, String? bucket, String? key})
-
Cloudflare R2 preset: the account-scoped S3 endpoint,
region = "auto", path-style addressing, and the fiveskip_*flags R2 needs because it implements no AWS metadata or STS surface.factory
Properties
- backendType → String
-
Backend type tag, e.g.
'gcs','s3','local'. Synth uses this as the JSON key underterraform.backend.<type>.no setteroverride - bucket → String?
-
S3 bucket holding the Terraform state file, or
nullfor a partial configuration that supplies it with-backend-config.final -
endpoints
→ Map<
String, String> ? -
Service endpoint overrides, e.g.
{'s3': 'https://<account>.r2.cloudflarestorage.com'}. Leave null for AWS.final - hashCode → int
-
The hash code for this object.
no setterinherited
- key → String?
-
Object key of the state file inside bucket, e.g.
terraform/site/terraform.tfstate. Terraform has no default here;nullleaves it to-backend-config.final - region → String?
-
Bucket region.
'auto'for R2.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- skipCredentialsValidation → bool?
-
Skip the STS credential preflight. Required off-AWS.
final
- skipMetadataApiCheck → bool?
-
Skip the EC2 instance metadata endpoint probe.
final
- skipRegionValidation → bool?
-
Skip validating region against the known AWS region list —
'auto'is not one of them.final - skipRequestingAccountId → bool?
-
Skip the STS
GetCallerIdentityaccount-id lookup.final - skipS3Checksum → bool?
-
Skip the trailing checksum on uploads. R2 rejects it.
final
- usePathStyle → bool?
-
Path-style addressing (
https://host/bucket/key) instead of virtual-hosted style. Required by most S3-compatible stores.final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
toTfJson(
) → Map< String, Object?> -
Backend-specific config block contents (bucket, prefix, etc.).
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited