Skip to content

Commit

Permalink
update state backend
Browse files Browse the repository at this point in the history
  • Loading branch information
jdbass committed May 12, 2024
1 parent 44d558a commit 598c39d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
24 changes: 12 additions & 12 deletions tofu/environments/stage/terraform/tfbackend/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions tofu/environments/stage/terraform/tfbackend/terragrunt.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ terraform {
}

locals {
bucket_name = "tb-${include.root.locals.short_name}-${include.environment.locals.environment}-state"
table_name = "tb-${include.root.locals.short_name}-${include.environment.locals.environment}-locks"
name_prefix = get_env("TF_VAR_name_prefix")

bucket_name = "${local.name_prefix}-state"
table_name = "${local.name_prefix}-locks"

project_tags = include.root.locals.tags
environment_tags = include.environment.locals.tags
Expand Down
6 changes: 4 additions & 2 deletions tofu/environments/terragrunt.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ locals {

project = local.project_vars.project
short_name = local.project_vars.short_name
name_prefix = get_env("TF_VAR_name_prefix")
region = get_env("TF_VAR_region")

tags = {
project = local.project
Expand All @@ -24,11 +26,11 @@ generate "backend" {
contents = <<EOF
terraform {
backend "s3" {
bucket = "tb-${local.short_name}-${local.env}-state"
bucket = "${local.name_prefix}-state"
key = "${path_relative_to_include()}/terraform.tfstate"
region = "us-east-1"
encrypt = true
dynamodb_table = "tb-${local.short_name}-${local.env}-locks"
dynamodb_table = "${local.name_prefix}-locks"
}
}
EOF
Expand Down

0 comments on commit 598c39d

Please sign in to comment.