You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Got an error of an "unrecognized GCE zone" when attempting to build without the region defined. This was corrected when region was included.
Expected behavior
Given that zone is required and region isn't I didn't include region. Figured there was some code to pull out the region from the zone. So I expected it to build with only the "Required" variables.
Observed behavior
Instead, I got the following terraform error.
module.sql-db_mysql.google_sql_database_instance.default: Creating...
╷
│ Error: Error, failed to create instance inm-platform-orchestration-db: googleapi: Error 400: Request contains unrecognized GCE zone when creating or updating an instance., errorUnrecognizedGceZone
│
│ with module.sql-db_mysql.google_sql_database_instance.default,
│ on .terraform/modules/sql-db_mysql/modules/mysql/main.tf line 43, in resource "google_sql_database_instance" "default":
│ 43: resource "google_sql_database_instance" "default" {
│
╵
I tested this on the latest provider version(5.6.0) and got the same result. The region variable has us-central1 set as the default value. If a module config sets only the zone variable, looks like it must be a zone in the default us-central1 region, else the apply will fail with a 400 error.
The simplest solution to avoid this scenario would be to make the region variable required, as suggested by @jruydemir. I guess this will be a breaking change.
In fact, zone can even be made optional as when no zone is passed, the Cloud SQL instance uses a random available zone from the given region automatically.
TL;DR
Got an error of an "unrecognized GCE zone" when attempting to build without the region defined. This was corrected when region was included.
Expected behavior
Given that zone is required and region isn't I didn't include region. Figured there was some code to pull out the region from the zone. So I expected it to build with only the "Required" variables.
Observed behavior
Instead, I got the following terraform error.
Terraform Configuration
Additional information
I tried this on the following versions of this module to the same result.
16.1.0
16.0.0
15.0.0
14.0.0
The text was updated successfully, but these errors were encountered: