Skip to content

Instantly share code, notes, and snippets.

@9oelM

9oelM/block12.tf Secret

Created March 21, 2021 13:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 9oelM/081d46a4583d202a63481b17dd1983d1 to your computer and use it in GitHub Desktop.
Save 9oelM/081d46a4583d202a63481b17dd1983d1 to your computer and use it in GitHub Desktop.
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.27"
}
}
+ backend "s3" {
+ profile = "localtf"
+ bucket = "my-iac" # change the bucket name to yours
+ key = "your-stack-name"
+ region = "us-west-2" # change to your region
+ dynamodb_table = "terraform-lock"
+ }
}
provider "aws" {
profile = "default"
region = "us-west-2" # you will need to change this to your region
}
resource "aws_dynamodb_table" "terraform_state_lock" {
name = "tf-state-locks"
read_capacity = 5
write_capacity = 5
hash_key = "LockID"
attribute {
name = "LockID"
type = "S"
}
}
resource "aws_s3_bucket" "terraform_backend" {
bucket = "tf-backend"
acl = "private"
versioning {
enabled = true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment