terraform-google-modules / terraform-example-foundation

Shows how the CFT modules can be composed to build a secure cloud foundation
https://cloud.google.com/architecture/security-foundations
Apache License 2.0
1.2k stars 706 forks source link

Location set in bootstrap is ignored - resources still deployed in us-central1 and us-west1 #1172

Closed mromascanu123 closed 2 months ago

mromascanu123 commented 5 months ago

TL;DR

Deployed with default_region = "northamerica-northeast2" in 0-bootstrap / terraform.auto.tfvars. Despite this (too many to enumerate) resources still deployed in us-central1 and us-west1. This is caused by module defaults (set in variables.tf) not being overriden when modules invoked from above

Expected behavior

Everything should be deployed in the specified region (or regions). However in terraform.auto.tfvars in 0-bootstrap we can specify a single region - while the deployment by default we specify a single region. Should have the deployment deploy in a single region, or 2 regions based exclusively on what was specified in bootstrap

Observed behavior

Here are a few examples image

Terraform Configuration

0-bootstrap / terraform.auto.tfvars
org_id = "946...etc" # format "000000000000"
billing_account = "01A5... etc" # format "000000-000000-000000"

... etc...
default_region = "northamerica-northeast2"

Terraform Version

[user@linuxbox ~]$ terraform version
Terraform v1.6.0
on linux_amd64

Additional information

Please fix region parameterization, having resources in multiple regions will make costs explode not to mention regulatory issues with data localization

fmichaelobrien commented 4 months ago

reverify after pulling also a related fix in https://github.com/terraform-google-modules/terraform-example-foundation/pull/1181

fmichaelobrien commented 4 months ago

stale bot timer restart - https://github.com/terraform-google-modules/terraform-example-foundation/blob/master/.github/workflows/stale.yml#L21

fmichaelobrien commented 4 months ago

verify as well 3-networks-hub-and-spoke

https://github.com/terraform-google-modules/terraform-example-foundation/blob/master/3-networks-hub-and-spoke/envs/shared/main.tf#L22

locals {
  env                = "common"
  environment_code   = "c"
  bgp_asn_number     = var.enable_partner_interconnect ? "16550" : "64514"
  dns_bgp_asn_number = var.enable_partner_interconnect ? "16550" : var.bgp_asn_dns
  default_region1    = "us-west1"
  default_region2    = "us-central1"
eeaton commented 2 months ago

1181 is merged