From c446c236d3bb8b46714f9a3a4d6f359d1624af9c Mon Sep 17 00:00:00 2001 From: Riley Karson Date: Fri, 8 Nov 2019 15:20:41 -0800 Subject: [PATCH] Stop users from specifying bigquery-json in 3.0.0 (#2626) --- .../resources/resource_google_project_service.go | 11 +++++++---- .../tests/resource_google_project_service_test.go | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/third_party/terraform/resources/resource_google_project_service.go b/third_party/terraform/resources/resource_google_project_service.go index c5eb63a6627d..fe1a79ccf6bd 100644 --- a/third_party/terraform/resources/resource_google_project_service.go +++ b/third_party/terraform/resources/resource_google_project_service.go @@ -10,12 +10,15 @@ import ( "google.golang.org/api/serviceusage/v1" ) -var ignoredProjectServices = []string{"dataproc-control.googleapis.com", "source.googleapis.com", "stackdriverprovisioning.googleapis.com"} - // These services can only be enabled as a side-effect of enabling other services, // so don't bother storing them in the config or using them for diffing. +var ignoredProjectServices = []string{"dataproc-control.googleapis.com", "source.googleapis.com", "stackdriverprovisioning.googleapis.com"} var ignoredProjectServicesSet = golangSetFromStringSlice(ignoredProjectServices) +// Services that can't be user-specified but are otherwise valid. Renamed +// services should be added to this set during major releases. +var bannedProjectServices = []string{"bigquery-json.googleapis.com"} + // Service Renames // we expect when a service is renamed: // - both service names will continue to be able to be set @@ -41,7 +44,7 @@ var ignoredProjectServicesSet = golangSetFromStringSlice(ignoredProjectServices) // upon removal, we should disallow the old name from being used even if it's // not gone from the underlying API yet var renamedServices = map[string]string{ - "bigquery-json.googleapis.com": "bigquery.googleapis.com", // DEPRECATED FOR 3.0.0 + "bigquery-json.googleapis.com": "bigquery.googleapis.com", // DEPRECATED FOR 4.0.0. Originally for 3.0.0, but the migration did not happen server-side yet. } // renamedServices in reverse (new -> old) @@ -75,7 +78,7 @@ func resourceGoogleProjectService() *schema.Resource { Type: schema.TypeString, Required: true, ForceNew: true, - ValidateFunc: StringNotInSlice(ignoredProjectServices, false), + ValidateFunc: StringNotInSlice(append(ignoredProjectServices, bannedProjectServices...), false), }, "project": { Type: schema.TypeString, diff --git a/third_party/terraform/tests/resource_google_project_service_test.go b/third_party/terraform/tests/resource_google_project_service_test.go index 6d8dfd81ff3f..08e1484c448f 100644 --- a/third_party/terraform/tests/resource_google_project_service_test.go +++ b/third_party/terraform/tests/resource_google_project_service_test.go @@ -142,7 +142,7 @@ func TestAccProjectService_renamedService(t *testing.T) { Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccProjectService_single("bigquery-json.googleapis.com", pid, pname, org), + Config: testAccProjectService_single("bigquery.googleapis.com", pid, pname, org), }, { ResourceName: "google_project_service.test",