Skip to content

Commit

Permalink
Stop users from specifying bigquery-json in 3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rileykarson committed Nov 8, 2019
1 parent 76670e3 commit 9f9f657
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 9f9f657

Please sign in to comment.