FAQ | This is a LIVE service | Changelog

Error in "uptime_monitoring" when running boiler plate

I'm getting this on the initial creation of https://gitlab.developers.cam.ac.uk/uis/devops/ssgw/deploy/-/issues/8:

Error: Invalid for_each argument

  on /terraform_data/modules/webapp/main.tf line 182, in module "uptime_monitoring":
 182:   for_each = toset(local.monitor_hosts)

The "for_each" value depends on resource attributes that cannot be determined
until apply, so Terraform cannot predict how many instances will be created.
To work around this, use the -target argument to first apply only the
resources that the for_each depends on.

I took it's advice and ran:

logan --workspace=development terraform apply -target module.webapp.google_cloud_run_service.webapp

This seemed to get me further along, however plan now gives:

module.webapp.module.uptime_monitoring["webapp-XXXXXXXXXX-nw.a.run.app"].data.google_project.project: Refreshing state...

Error: project: required field is not set

I've had a quick poke around in https://gitlab.developers.cam.ac.uk/uis/devops/infra/terraform/gcp-site-monitoring but may have exhausted my terraform chops..