From 9f9f65736c93b26bd9f18660e0fbb8f63db6f832 Mon Sep 17 00:00:00 2001 From: Riley Karson Date: Fri, 8 Nov 2019 13:11:20 -0800 Subject: [PATCH] Stop users from specifying bigquery-json in 3.0.0 --- .../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 1d949abc8225..c4c78d56faa6 100644 --- a/third_party/terraform/resources/resource_google_project_service.go +++ b/third_party/terraform/resources/resource_google_project_service.go @@ -11,12 +11,15 @@ import ( "time" ) -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 @@ -42,7 +45,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) @@ -76,7 +79,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",