Editing Terraform backends
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 2: | Line 2: | ||
* <code>[[backend.tf]]</code> | * <code>[[backend.tf]]</code> | ||
− | + | * [[Terraform S3 backend]] | |
− | + | * [[Terraform S3 backend: dynamodb table]] | |
− | * [[Terraform S3 backend]] | + | * [[artifactory]] |
− | * [[Terraform S3 backend: | + | * [[local]] |
− | * | ||
− | * [[ | ||
− | |||
* [[consul]] | * [[consul]] | ||
+ | * [[remote]] | ||
* [[COS]]: [[Tencent Cloud Object Storage (COS)]] | * [[COS]]: [[Tencent Cloud Object Storage (COS)]] | ||
* [[Kubernetes]] | * [[Kubernetes]] | ||
+ | * [[Manta]] | ||
* [[pg]] ([[PostgreSQL]]) | * [[pg]] ([[PostgreSQL]]) | ||
− | * [[ | + | * [[gcs]] |
− | + | https://www.terraform.io/language/settings/backends/s3 | |
− | === | + | == [[Terraform S3 backend|S3]] Example with [[DynamoDB]] == |
− | + | terraform { | |
− | + | backend "s3" { | |
− | + | [[bucket]] = "your-terraform-states" | |
− | + | [[key]]<ref>https://www.terraform.io/docs/language/settings/backends/s3.html#key</ref> = "[[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 terms == | == Related terms == | ||
* <code>[[terraform workspace]]</code> | * <code>[[terraform workspace]]</code> | ||
− | |||
* <code>[[terraform state]] [pull | push]</code> | * <code>[[terraform state]] [pull | push]</code> | ||
* <code>[[AWS_PROFILE]]</code> | * <code>[[AWS_PROFILE]]</code> | ||
− | * | + | * <code>[[profile]]</code> https://www.terraform.io/docs/language/settings/backends/s3.html#profile |
* <code>[[aws s3api create-bucket]]</code> and <code>[[aws s3 mb]]</code> | * <code>[[aws s3api create-bucket]]</code> and <code>[[aws s3 mb]]</code> | ||
− | + | * [[Terraform providers]]: <code>[[provider.tf]]</code> | |
* [[Terraform Associate]]: Handle backend [[authentication methods]] | * [[Terraform Associate]]: Handle backend [[authentication methods]] | ||
* <code>[[local]]</code> backend | * <code>[[local]]</code> backend | ||
* [[Workspaces]] and [[locking]] | * [[Workspaces]] and [[locking]] | ||
− | * | + | * [[Remote state backends to manage Terraform state]] |
− | |||
− | |||
− | |||
− | |||
− | |||
== See also == | == See also == | ||
* {{Terraform backends}} | * {{Terraform backends}} | ||
+ | * {{Terraform}} | ||
[[Category:Terraform]] | [[Category:Terraform]] |
Advertising: