FAQ | This is a LIVE service | Changelog

First time use of this module can lead to terraform errors.

Since 0753dceb an initial plan or apply from terraform using this module can fail, because (I think) sql_instance_connection_name can't be determined until the instance has actually been created.

A workaround for the time being is to do an apply targetting the module creating the sql instance before doing the full apply.

The full error:

Error: Invalid count argument

  on /terraform_data/modules/webapp/main.tf line 13, in resource "google_project_iam_member" "webapp_sql_client":
  13:   count = (var.sql_instance_connection_name != "") ? 1 : 0

The "count" 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 count depends on.
Edited by Dr Rich Wareham