diff --git a/deployment/live/example-gcp/ci/terragrunt.hcl b/deployment/live/example-gcp/ci/terragrunt.hcl index 4a3ce68a7..0fe25b557 100644 --- a/deployment/live/example-gcp/ci/terragrunt.hcl +++ b/deployment/live/example-gcp/ci/terragrunt.hcl @@ -2,27 +2,15 @@ terraform { source = "${get_repo_root()}/deployment/modules/example-gcp" } -locals { - project_id = get_env("GOOGLE_PROJECT", "trillian-tessera") - location = get_env("GOOGLE_REGION", "us-central1") - base_name = get_env("TESSERA_BASE_NAME", "example-gcp") +include "root" { + path = find_in_parent_folders() + expose = true } inputs = merge( - local, - {} + include.root.locals, + { + example_docker_image = "todo" + } ) -remote_state { - backend = "gcs" - - config = { - project = local.project_id - location = local.location - bucket = "${local.project_id}-${local.base_name}-terraform-state" - - gcs_bucket_labels = { - name = "terraform_state_storage" - } - } -} diff --git a/deployment/live/example-gcp/terragrunt.hcl b/deployment/live/example-gcp/terragrunt.hcl new file mode 100644 index 000000000..be74a4f6a --- /dev/null +++ b/deployment/live/example-gcp/terragrunt.hcl @@ -0,0 +1,25 @@ +terraform { + source = "${get_repo_root()}/deployment/modules/example-gcp" +} + +locals { + project_id = get_env("GOOGLE_PROJECT", "trillian-tessera") + location = get_env("GOOGLE_REGION", "us-central1") + base_name = get_env("TESSERA_BASE_NAME", "example-gcp") + env = path_relative_to_include() +} + +remote_state { + backend = "gcs" + + config = { + project = local.project_id + location = local.location + bucket = "${local.project_id}-${local.base_name}-${local.env}-terraform-state" + prefix = "${path_relative_to_include()}/terraform.tfstate" + + gcs_bucket_labels = { + name = "terraform_state_storage" + } + } +} diff --git a/deployment/modules/example-gcp/main.tf b/deployment/modules/example-gcp/main.tf index 2697fc864..23f8430ae 100644 --- a/deployment/modules/example-gcp/main.tf +++ b/deployment/modules/example-gcp/main.tf @@ -2,12 +2,13 @@ terraform { backend "gcs" {} } -module "infra" { - source = "../../../modules/gcp" +module "gcp" { + source = "../../../modules" project_id = var.project_id base_name = var.base_name location = var.location + env = var.env } ###