-
-
Save 9oelM/86352ca003e1bf874662650c0ce183d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
terraform { | |
required_providers { | |
aws = { | |
source = "hashicorp/aws" | |
version = "~> 3.27" | |
} | |
docker = { | |
source = "kreuzwerker/docker" | |
version = ">= 2.8.0" | |
} | |
} | |
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 | |
+ assume_role { | |
+ role_arn = "arn:aws:iam::{your-account-id}:role/hello_role" | |
+ session_name = "terraform" | |
+ } | |
} | |
# you can create this resource in other repository because it's not specific to this project | |
# 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" | |
# } | |
# } | |
# you can create this resource in other repository because it's not specific to this project | |
# 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