GoogleCloudPlatform / pbmm-on-gcp-onboarding

GCP Canadian Public Sector Landing Zone overlay on top of the TEF via CFT modules - a secure cloud foundation
https://cloud.google.com/architecture/security-foundations
Apache License 2.0
39 stars 55 forks source link

1-org tf plan check step 9 requires a 0-bootstrap plan check on backend validation errors - due to terraform 1.3.0 (docker) and 1.7.4 (console) mismatch - may require console terraform downgrade before starting deployment and creating the state file #364

Open fmichaelobrien opened 2 months ago

fmichaelobrien commented 2 months ago

step 9 of https://github.com/GoogleCloudPlatform/pbmm-on-gcp-onboarding/tree/main/1-org#deploying-with-cloud-build

1-org - step 9 checking tf plan issues - was due to bootstrap

Screenshot 2024-03-12 at 11 07 07

gcp-org - plan

**************************************************
data.terraform_remote_state.bootstrap: Reading...
module.cai_monitoring.data.archive_file.function_source_zip: Reading...
module.cai_monitoring.data.archive_file.function_source_zip: Read complete after 0s [id=1e9314009f01646867d2cae991af75d380d72df9]
module.org_domain_restricted_sharing.data.google_organization.orgs["obrienlabs.app"]: Reading...
module.org_domain_restricted_sharing.data.google_organization.orgs["obrienlabs.app"]: Read complete after 0s [id=organizations/630259462753]

Error: Error loading state error

  with data.terraform_remote_state.bootstrap,
  on remote.tf line 38, in data "terraform_remote_state" "bootstrap":
  38:   backend = "gcs"

error loading the remote state: 16 problems:

- unsupported checkable object kind "var"

1-org step 9 terraform version mismatch mitigation

I was hoping to avoid a terraform downgrade until we get into refactoring but it looks like a 1.7.4 to 1.3.0 TF downgrade is required before creating the state file - or we get into a situation where the cloud build triggered plan running 1.3.0 cannot reconcile with the state file created in the gcp console under 1.7.4. Either we restart the deployment after downgrading or upgrade the TEF to TF 1.7 - will need to do this before moving on to 2-environments

TF Versions Cloud Build via Dockerfile is 1.3.0 https://github.com/terraform-google-modules/terraform-example-foundation/blob/master/0-bootstrap/Dockerfile#L18

ARG TERRAFORM_VERSION=1.3.0

GCP console as of 202403 is 1.7.4

michael@cloudshell:~/tef-olapp/github/gcp-org (tef-olapp)$ terraform --version
Terraform v1.7.4
on linux_amd64