Skip to content

Commit

Permalink
update backend gen to ent standard
Browse files Browse the repository at this point in the history
  • Loading branch information
morga471 committed Sep 12, 2024
1 parent c080c9a commit 4ce55d3
Showing 1 changed file with 43 additions and 34 deletions.
77 changes: 43 additions & 34 deletions lab/us-gov-east-1/vpc/_mcmCluster/terragrunt.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -23,43 +23,45 @@ locals {
project_number = "fs0000000078"
project_role = "csvd_platformbaseline_cicd"
region = local.region_vars.locals.aws_region
state_bucket_prefix = "inf-tfstate"
state_table_name = "tf_remote_state"
}

generate "provider" {
path = "provider.tf"
if_exists = "overwrite_terragrunt"
contents = <<EOF
terraform {
required_version = ">= 1.5.0"
}
provider "aws" {
region = "${local.region}"
profile = "${local.profile}"
default_tags {
tags = {
ProjectNumber = "${local.project_number}"
"Project Name" = "${local.project_name}"
"Project Role" = "${local.project_role}"
"Project Identifier" = "${local.project_number}:${local.project_name}"
Organization = "${local.organization}"
created_by = "${local.creator}"
created_for = "${local.creator}"
created_reason = "Exploration of Terragrunt and Demonstration of CICD for Infrastructure"
Terraform = "true"
Terragrunt = "true"
terraform {
required_version = ">= 1.5.0"
}
provider "aws" {
region = "${local.region}"
profile = "${local.profile}"
default_tags {
tags = {
ProjectNumber = "${local.project_number}"
"Project Name" = "${local.project_name}"
"Project Role" = "${local.project_role}"
"Project Identifier" = "${local.project_number}:${local.project_name}"
Organization = "${local.organization}"
created_by = "${local.creator}"
created_for = "${local.creator}"
created_reason = "Exploration of Terragrunt and Demonstration of CICD for Infrastructure"
Terraform = "true"
Terragrunt = "true"
}
}
# Only these AWS Account IDs may be operated on by this template
allowed_account_ids = ["${local.account_id}"]
}
# Only these AWS Account IDs may be operated on by this template
allowed_account_ids = ["${local.account_id}"]
}
provider "kubernetes" {
config_path = "~/.kube/config"
}
provider "helm" {
kubernetes {
config_path = "~/.kube/config"
provider "kubernetes" {
config_path = "~/.kube/config"
}
provider "helm" {
kubernetes {
config_path = "~/.kube/config"
}
}
Expand All @@ -69,18 +71,25 @@ EOF
remote_state {
backend = "s3"
generate = {
path = "backend.tf"
path = "remote_state.backend.tf"
if_exists = "overwrite_terragrunt"
}
config = {
bucket = "v-s3-tg-tf-state-${local.account_name}-${local.region}"
key = "${local.project_number}/${local.project_name}/${local.project_role}/${path_relative_to_include()}/terraform.tfstate"
region = local.region
encrypt = true
dynamodb_table = "tf_remote_state"
#---
# "${local.account_name}": "${get_path_from_repo_root()}"
#---
bucket = "${local.state_bucket_prefix}-${local.account_id}"
profile = "${local.profile}"
key = "${trimprefix(replace(run_cmd("realpath",get_original_terragrunt_dir()),dirname(get_repo_root()),""),"/")}"
region = "${local.region}"
dynamodb_table = "${local.state_table_name}"
skip_bucket_root_access = true
skip_bucket_ssencryption = true
skip_bucket_enforced_tls = true
}
}


inputs = merge(
local.account_vars.locals,
# local.common_vars.locals,
Expand Down

0 comments on commit 4ce55d3

Please sign in to comment.