From 59a2e75f5f5b088c9d4156c614e433be76f5dec3 Mon Sep 17 00:00:00 2001 From: Riley Karson Date: Fri, 11 Oct 2019 10:51:33 -0700 Subject: [PATCH] Fix compute_zones datasource (Compute client has a fixed version) --- .../data_sources/data_source_google_compute_zones.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/third_party/terraform/data_sources/data_source_google_compute_zones.go b/third_party/terraform/data_sources/data_source_google_compute_zones.go index efadf2703b13..981026e9ab20 100644 --- a/third_party/terraform/data_sources/data_source_google_compute_zones.go +++ b/third_party/terraform/data_sources/data_source_google_compute_zones.go @@ -51,7 +51,13 @@ func dataSourceGoogleComputeZonesRead(d *schema.ResourceData, meta interface{}) return err } - regionUrl, err := replaceVars(d, config, fmt.Sprintf("{{ComputeBasePath}}projects/%s/regions/%s", project, region)) + // we want to share exactly the same base path as the compute client or the + // region string may mismatch, giving us no results + // note that the client's BasePath includes a `projects/` suffix, so that'll + // need to be added to the URL below if the source changes + computeClientBasePath := config.clientCompute.BasePath + + regionUrl, err := replaceVars(d, config, fmt.Sprintf("%s%s/regions/%s", computeClientBasePath, project, region)) if err != nil { return err }