terraform-example-foundation icon indicating copy to clipboard operation
terraform-example-foundation copied to clipboard

Sections "Run Terraform locally" refer to CLOUD_BUILD_PROJECT_ID which does not exist

Open mromascanu123 opened this issue 1 year ago • 0 comments

TL;DR

When running locally w/o CB, Jenkins, TFC, etc there is no cloudbuild project. We have just a seed project and a "dummy" ci-cd project, unused but created anyway to avoid fixing broken code assuming it should exist even when deploying locally

Expected behavior

The command, if required and if the result pertinent, should succeed. Otherwise remove it from the readme's or change it providing an existing project id

Observed behavior

Subdjacent command fails: gcloud beta terraform vet "${tf_file}.json" --policy-library="${policy_file_path}" --project="${project_id}"

./tf-wrapper.sh validate production $(pwd)/../policy-library ${CLOUD_BUILD_PROJECT_ID}

ERROR: (gcloud.beta.terraform.vet) The project property is set to the empty string, which is invalid.

Terraform Configuration

in 0-bootstrap : terraform.tf
locals {
  cicd_project_id = module.local_cicd.project_id
}

module "local_cicd" {
  source  = "terraform-google-modules/project-factory/google"

  name              = "${var.project_prefix}-b-cicd-local"
  random_project_id = true
  org_id            = var.org_id
  folder_id         = google_folder.bootstrap.id
  billing_account   = var.billing_account
  activate_apis = [
    "compute.googleapis.com",
    "admin.googleapis.com",
    "iam.googleapis.com",
    "billingbudgets.googleapis.com",
    "cloudbilling.googleapis.com",
    "serviceusage.googleapis.com",
    "cloudresourcemanager.googleapis.com",
    "iamcredentials.googleapis.com",
  ]
}

Terraform Version

Terraform v1.6.0
on linux_amd64

Your version of Terraform is out of date! The latest version
is 1.7.5. You can update by downloading from https://www.terraform.io/downloads.html

Additional information

No response

mromascanu123 avatar Mar 18 '24 17:03 mromascanu123