Skip to content

Multi-Cloud Backends

Configure secure, remote state storage for testform.state in your enterprise cloud of choice.

1. Oracle Cloud Infrastructure (OCI Object Storage)

Section titled “1. Oracle Cloud Infrastructure (OCI Object Storage)”

OCI Object Storage stores your state file in a cloud bucket utilizing conditional ETags for atomic writes:

version: "1.0"
backend:
type: "oci"
namespace: "my-tenancy-namespace"
bucket: "testform-state"
object_name: "production/testform.state"
tenancy_id: "ocid1.tenancy.oc1..aaaaaaaaxxxxx"
user_id: "ocid1.user.oc1..aaaaaaaayyyyy"
fingerprint: "20:3b:97:13:55:1c:..."
private_key_path: "~/.oci/oci_api_key.pem"
region: "us-ashburn-1"

2. Amazon Web Services (AWS S3 + DynamoDB)

Section titled “2. Amazon Web Services (AWS S3 + DynamoDB)”

Combines an S3 bucket for state storage with a DynamoDB table for distributed mutex locking:

version: "1.0"
backend:
type: "s3"
bucket: "company-testform-tfstate"
key: "core/testform.state"
region: "us-east-1"
dynamodb_table: "testform-locks"
encrypt: true

Required environment variables:

  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
  • AWS_REGION

Stores the state in Azure Blob Storage utilizing native blob leases for mutual exclusion:

version: "1.0"
backend:
type: "azure"
storage_account: "companytestform"
container: "tfstate"
blob_name: "qa/testform.state"

Required environment variables:

  • ARM_CLIENT_ID
  • ARM_CLIENT_SECRET
  • ARM_SUBSCRIPTION_ID
  • ARM_TENANT_ID

Utilizes GCS object generation preconditions to prevent concurrent updates:

version: "1.0"
backend:
type: "gcs"
bucket: "company-testform-state"
prefix: "qa-environments"

Required environment variable:

  • GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json