terraform-provider-googleworkspace
terraform-provider-googleworkspace copied to clipboard
New Env Var: `GOOGLEWORKSPACE_OAUTH_SCOPES`
This PR allows the provider to use a env var GOOGLEWORKSPACE_OAUTH_SCOPES for setting the OAuth Scopes used with the credentials call.
Is necessary when your workspace user is not delegated all scopes/access, but you'd rather not set them in each individual provider block.
Env Used:
export GOOGLEWORKSPACE_IMPERSONATED_USER_EMAIL="<redacted>"
export GOOGLEWORKSPACE_DOMAIN="<redacted>"
export GOOGLEWORKSPACE_CUSTOMER_ID="<redacted>"
export GOOGLEWORKSPACE_CREDENTIALS="$HOME/.googleworkspace/<redacted>.json"
export GOOGLEWORKSPACE_OAUTH_SCOPES="https://www.googleapis.com/auth/admin.directory.group,https://www.googleapis.com/auth/admin.directory.user"
Test Results:
{21-07-08 13:35}tmps-nb-2168:~/Project_WorkDir/terraform-provider-googleworkspace@scope_env_var thomas.goodsell% make testacc TESTARGS="-run=TestAccResourceGroup_basic"
==> Checking source code against gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test -count=1 $(go list ./...) -v -run=TestAccResourceGroup_basic -timeout 120m
? github.com/hashicorp/terraform-provider-googleworkspace [no test files]
=== RUN TestAccResourceGroup_basic
=== PAUSE TestAccResourceGroup_basic
=== CONT TestAccResourceGroup_basic
--- PASS: TestAccResourceGroup_basic (55.59s)
PASS
ok github.com/hashicorp/terraform-provider-googleworkspace/internal/provider 55.925s
{21-07-08 13:36}tmps-nb-2168:~/Project_WorkDir/terraform-provider-googleworkspace@scope_env_var thomas.goodsell% make testacc TESTARGS="-run=TestAccResourceUser_basic"
==> Checking source code against gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test -count=1 $(go list ./...) -v -run=TestAccResourceUser_basic -timeout 120m
? github.com/hashicorp/terraform-provider-googleworkspace [no test files]
=== RUN TestAccResourceUser_basic
=== PAUSE TestAccResourceUser_basic
=== CONT TestAccResourceUser_basic
--- PASS: TestAccResourceUser_basic (86.34s)
PASS
ok github.com/hashicorp/terraform-provider-googleworkspace/internal/provider 86.640s
I've had a bit more time to play with this. It seems like this is an open issue in the SDK. I'll follow up with them and see if we can figure out a workaround.
Closing to re-do in the terraform-provider-framework style.