github.com/xsb/terraform@v0.6.13-0.20160314145438-fe415c2f09d7/website/source/docs/state/remote/s3.html.md (about) 1 --- 2 layout: "remotestate" 3 page_title: "Remote State Backend: s3" 4 sidebar_current: "docs-state-remote-s3" 5 description: |- 6 Terraform can store the state remotely, making it easier to version and work with in a team. 7 --- 8 9 # s3 10 11 Stores the state as a given key in a given bucket on [Amazon S3](https://aws.amazon.com/s3/). 12 13 -> **Note:** Passing credentials directly via config options will 14 make them included in cleartext inside the persisted state. 15 Use of environment variables or config file is recommended. 16 17 ## Example Usage 18 19 ``` 20 terraform remote config \ 21 -backend=s3 \ 22 -backend-config="bucket=terraform-state-prod" \ 23 -backend-config="key=network/terraform.tfstate" \ 24 -backend-config="region=us-east-1" 25 ``` 26 27 ## Example Referencing 28 29 ``` 30 resource "terraform_remote_state" "foo" { 31 backend = "s3" 32 config { 33 bucket = "terraform-state-prod" 34 key = "network/terraform.tfstate" 35 region = "us-east-1" 36 } 37 } 38 ``` 39 40 ## Configuration variables 41 42 The following configuration options / environment variables are supported: 43 44 * `bucket` - (Required) The name of the S3 bucket 45 * `key` - (Required) The path where to place/look for state file inside the bucket 46 * `region` / `AWS_DEFAULT_REGION` - (Optional) The region of the S3 bucket 47 * `endpoint` / `AWS_S3_ENDPOINT` - (Optional) A custom endpoint for the S3 API 48 * `encrypt` - (Optional) Whether to enable [server side encryption](https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingServerSideEncryption.html) 49 of the state file 50 * `acl` - [Canned ACL](https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl) 51 to be applied to the state file. 52 * `access_key` / `AWS_ACCESS_KEY_ID` - (Optional) AWS access key 53 * `secret_key` / `AWS_SECRET_ACCESS_KEY` - (Optional) AWS secret key 54 * `kms_key_id` - (Optional) The ARN of a KMS Key to use for encrypting the state.