Difference between revisions of "Backend.tf"
Jump to navigation
Jump to search
↑ https://www.terraform.io/docs/language/settings/backends/s3.html#key
(11 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{lc}} | {{lc}} | ||
− | == Terraform Cloud == | + | == [[Terraform Cloud]] == |
+ | |||
+ | <pre><nowiki> | ||
terraform { | terraform { | ||
backend "remote" { | backend "remote" { | ||
Line 12: | Line 14: | ||
} | } | ||
− | required_version = ">= | + | required_version = ">= 0.14.0" |
} | } | ||
+ | </nowiki></pre> | ||
== [[Terraform S3 backend|S3]] Example with [[DynamoDB]] == | == [[Terraform S3 backend|S3]] Example with [[DynamoDB]] == | ||
− | + | ||
− | + | {{backend s3}} | |
− | + | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
Example using variables: | Example using variables: | ||
terraform { | terraform { | ||
− | backend "s3" { | + | [[backend]] "s3" { |
bucket = "$(aws-backend-bucket)" | bucket = "$(aws-backend-bucket)" | ||
key = "yourkeyname/$(AWS_ACCOUNTNAME)/$(AWS_MYREGION)" | key = "yourkeyname/$(AWS_ACCOUNTNAME)/$(AWS_MYREGION)" | ||
Line 39: | Line 35: | ||
} | } | ||
− | + | == Related == | |
− | + | * <code>[[Terraform backend: remote]]</code> | |
− | + | * <code>[[terraform_remote_state]]</code> | |
== See also == | == See also == |
Latest revision as of 16:26, 15 November 2023
Terraform Cloud[edit]
terraform { backend "remote" { organization = "{{ORGANIZATION_NAME}}" workspaces { name = "{{WORKSPACE_NAME}}" } } required_version = ">= 0.14.0" }
S3 Example with DynamoDB[edit]
terraform { backend "s3" { bucket = "your-terraform-states" key[1] = "terraform.tfstate" region = "us-west-2" dynamodb_table = "your-terraform-states" profile = "your-profile" workspace_key_prefix = "your-workspace" } }
Example using variables:
terraform { backend "s3" { bucket = "$(aws-backend-bucket)" key = "yourkeyname/$(AWS_ACCOUNTNAME)/$(AWS_MYREGION)" region = "$(AWS_MYREGION)" dynamodb_table = "$(aws-backend-dynamoDbTable)" encrypt = true role_arn = "$(aws-cicd-role-arn)" } }
Related[edit]
See also[edit]
Advertising: