Skip to content

Terraform state backend

Terraform backend handling can be also configured. For more informations about backend types read: https://www.terraform.io/docs/backends/index.html

Providing credentials is optional. Terraform can use environment variables or ask for the input on init phase.

File should be created in the terraform directory:

vSphere - cb-opscontrol/terraform/vsphere/backend.tf
AWS - cb-opscontrol/terraform/aws/backend.tf
OpenStack - cb-opscontrol/terraform/openstack/backend.tf
Azure - cb-opscontrol/terraform/azure/backend.tf

Example of configuration for S3:

terraform {
  backend "s3" {
    access_key="XXXXXXX"
    secret_key="XXXXXX"
    key = "terraform.tfstate"
    bucket = "terraform-state"
    region = "us-east-1"
  }
}

Example of configuration for Minio:

terraform {
  backend "s3" {
    access_key="admin"
    endpoint = "http://minio.local"
    key = "terraform.tfstate"
    bucket = "terraform-state"
    region = "main"
    skip_requesting_account_id = true
    skip_credentials_validation = true
    skip_get_ec2_platforms = true
    skip_metadata_api_check = true
    skip_region_validation = true
    force_path_style = true
  }
}