Skip to content

Commit

Permalink
Remove redundant default scopes (#5343) (#3756)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Oct 22, 2021
1 parent 7d969e9 commit b48aec7
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .changelog/5343.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:breaking-change
provider: removed redundant default scopes. The provider's default scopes when authenticating with credentials are now exclusively "https://www.googleapis.com/auth/cloud-platform" and "https://www.googleapis.com/auth/userinfo.email".
```
4 changes: 0 additions & 4 deletions google-beta/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,11 +370,7 @@ var DefaultBasePaths = map[string]string{
}

var DefaultClientScopes = []string{
"https://www.googleapis.com/auth/compute",
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/cloud-identity",
"https://www.googleapis.com/auth/ndev.clouddns.readwrite",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/userinfo.email",
}

Expand Down
3 changes: 1 addition & 2 deletions google-beta/resource_dataproc_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"

"google.golang.org/api/googleapi"

dataproc "google.golang.org/api/dataproc/v1beta2"
"google.golang.org/api/googleapi"
)

func TestDataprocExtractInitTimeout(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion google-beta/resource_gke_hub_feature_membership_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"testing"

"github.com/GoogleCloudPlatform/declarative-resource-client-library/dcl"
dcl "github.com/GoogleCloudPlatform/declarative-resource-client-library/dcl"
gkehub "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/gkehub/beta"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
Expand Down
3 changes: 0 additions & 3 deletions website/docs/guides/provider_reference.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,7 @@ an access token using the service account key specified in `credentials`.

By default, the following scopes are configured:

* https://www.googleapis.com/auth/compute
* https://www.googleapis.com/auth/cloud-platform
* https://www.googleapis.com/auth/ndev.clouddns.readwrite
* https://www.googleapis.com/auth/devstorage.full_control
* https://www.googleapis.com/auth/userinfo.email

* `request_reason` - (Optional) Send a Request Reason [System Parameter](https://cloud.google.com/apis/docs/system-parameters) for each API call made by the provider. The `X-Goog-Request-Reason` header value is used to provide a user-supplied justification into GCP AuditLogs. Alternatively, this can be specified using the `CLOUDSDK_CORE_REQUEST_REASON` environment variable.
Expand Down
21 changes: 21 additions & 0 deletions website/docs/guides/version_4_upgrade.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ description: |-
- [I accidentally upgraded to 4.0.0, how do I downgrade to `3.X`?](#i-accidentally-upgraded-to-400-how-do-i-downgrade-to-3x)
- [Provider Version Configuration](#provider-version-configuration)
- [Provider](#provider)
- [Redundant default scopes are removed](#redundant-default-scopes-are-removed)
- [Runtime Configurator (`runtimeconfig`) resources have been removed from the GA provider](#runtime-configurator-runtimeconfig-resources-have-been-removed-from-the-ga-provider)
- [Datasource: `google_product_resource`](#datasource-google_product_resource)
- [Datasource-level change example](#datasource-level-change-example)
Expand Down Expand Up @@ -154,6 +155,26 @@ terraform {

## Provider

### Redundant default scopes are removed

Several default scopes are removed from the provider:

* "https://www.googleapis.com/auth/compute"
* "https://www.googleapis.com/auth/ndev.clouddns.readwrite"
* "https://www.googleapis.com/auth/devstorage.full_control"
* "https://www.googleapis.com/auth/cloud-identity"

They are redundant with the "https://www.googleapis.com/auth/cloud-platform"
scope per [Access scopes](https://cloud.google.com/compute/docs/access/service-accounts#accesscopesiam).
After this change the following scopes are enabled, in line with `gcloud`'s
[list of scopes](https://cloud.google.com/sdk/gcloud/reference/auth/application-default/login):

* "https://www.googleapis.com/auth/cloud-platform"
* "https://www.googleapis.com/auth/userinfo.email"

This change is believed to have no user impact. If you find that Terraform
behaves incorrectly as a result of this change, please report a [bug](https://github.com/hashicorp/terraform-provider-google/issues/new?assignees=&labels=bug&template=bug.md).

### Runtime Configurator (`runtimeconfig`) resources have been removed from the GA provider

Earlier versions of the provider accidentally included the Runtime Configurator
Expand Down

0 comments on commit b48aec7

Please sign in to comment.