GoogleCloudPlatform / cloud-ops-sandbox

Cloud Operations Sandbox is an open source collection of tools that helps practitioners to learn O11y and R9y practices from Google and apply them using Cloud Operations suite of tools.
Apache License 2.0
406 stars 148 forks source link

Invalid provider configuration #991

Closed mattycourtney closed 2 years ago

mattycourtney commented 2 years ago

sandboxctl create fails to deploy whilst trying to deploy the Terraform manifests

+ log 'create a new Sandbox!'
+ echo 'create a new Sandbox!'
create a new Sandbox!
+ createProject
++ od -N 4 -t uL -An /dev/urandom
++ tr -d ' '
+ project_id=cloud-ops-sandbox-2091314289
+ gcloud projects create cloud-ops-sandbox-2091314289 '--name=Cloud Operations Sandbox Demo'
Create in progress for [https://cloudresourcemanager.googleapis.com/v1/projects/cloud-ops-sandbox-2091314289].
Waiting for [operations/cp.8981158120560589141] to finish...done.    
Enabling service [cloudapis.googleapis.com] on project [cloud-ops-sandbox-2091314289]...
Operation "operations/acat.p2-713848874804-c74fe437-ebdb-47ed-8585-664fbfa1fc5f" finished successfully.
+ gcloud beta billing projects link cloud-ops-sandbox-2091314289 --billing-account=REDACTED
billingAccountName: billingAccounts/REDACTED
billingEnabled: true
name: projects/cloud-ops-sandbox-2091314289/billingInfo
projectId: cloud-ops-sandbox-2091314289
+ break
+ IFS='
'
+ gcloud config set project cloud-ops-sandbox-2091314289
Updated property [core/project].
+ getOrCreateBucket
+ bucket_name=cloud-ops-sandbox-2091314289-bucket
+ gcloud config set project cloud-ops-sandbox-2091314289
Updated property [core/project].
++ gsutil ls
++ grep gs://cloud-ops-sandbox-2091314289-bucket/
+ [[ -n '' ]]
+ TRIES=0
++ gsutil mb -p cloud-ops-sandbox-2091314289 gs://cloud-ops-sandbox-2091314289-bucket
Creating gs://cloud-ops-sandbox-2091314289-bucket/...
+ [[ -n '' ]]
+ [[ 0 -lt 5 ]]
+ log 'Checking if bucket cloud-ops-sandbox-2091314289-bucket exists...'
+ echo 'Checking if bucket cloud-ops-sandbox-2091314289-bucket exists...'
Checking if bucket cloud-ops-sandbox-2091314289-bucket exists...
++ gsutil ls
++ grep gs://cloud-ops-sandbox-2091314289-bucket/
+ [[ -n gs://cloud-ops-sandbox-2091314289-bucket/ ]]
+ log 'Bucket cloud-ops-sandbox-2091314289-bucket created'
+ echo 'Bucket cloud-ops-sandbox-2091314289-bucket created'
Bucket cloud-ops-sandbox-2091314289-bucket created
+ break
+ applyTerraform
+ rm -f .terraform/terraform.tfstate
+ log 'Initialize terraform backend with bucket cloud-ops-sandbox-2091314289-bucket'
+ echo 'Initialize terraform backend with bucket cloud-ops-sandbox-2091314289-bucket'
Initialize terraform backend with bucket cloud-ops-sandbox-2091314289-bucket
+ terraform init -backend-config bucket=cloud-ops-sandbox-2091314289-bucket -lockfile=false
Initializing modules...
- loadgen in loadgen
- ratingservice in ratingservice

Initializing the backend...

Successfully configured the backend "gcs"! Terraform will automatically
use this backend unless the backend configuration changes.

Initializing provider plugins...
- terraform.io/builtin/terraform is built in to Terraform
- Finding hashicorp/random versions matching "~> 2.0"...
- Finding latest version of hashicorp/null...
- Finding latest version of hashicorp/external...
- Finding hashicorp/google versions matching "3.90.0"...
- Installing hashicorp/random v2.3.1...
- Installed hashicorp/random v2.3.1 (signed by HashiCorp)
- Installing hashicorp/null v3.2.0...
- Installed hashicorp/null v3.2.0 (signed by HashiCorp)
- Installing hashicorp/external v2.2.3...
- Installed hashicorp/external v2.2.3 (signed by HashiCorp)
- Installing hashicorp/google v3.90.0...
- Installed hashicorp/google v3.90.0 (signed by HashiCorp)

Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
+ log 'Credential check OK...'
+ echo 'Credential check OK...'
Credential check OK...
+ terraform_command='terraform apply -auto-approve -var="project_id=cloud-ops-sandbox-2091314289" -var="bucket_name=cloud-ops-sandbox-2091314289-bucket" -var="skip_ratingservice=false" -var="skip_loadgen=false"'
+ [[ -n 01E4D1-2EBAD3-5966BE ]]
+ terraform_command+=' -var="billing_account=REDACTED"'
++ gcloud container clusters list '--format=value(location)' --filter name=cloud-ops-sandbox
WARNING: The following filter keys were not present in any resource : name
+ gke_location=
+ [[ -n '' ]]
+ [[ -n v0.8.1 ]]
++ echo v0.8.1
++ tr . _
+ app_ver=v0_8_1
+ terraform_command+=' -var="app_version=v0_8_1"'
+ log 'Apply Terraform automation'
+ echo 'Apply Terraform automation'
Apply Terraform automation
+ eval terraform apply -auto-approve '-var="project_id=cloud-ops-sandbox-2091314289"' '-var="bucket_name=cloud-ops-sandbox-2091314289-bucket"' '-var="skip_ratingservice=false"' '-var="skip_loadgen=false"' '-var="billing_account=REDACTED"' '-var="app_version=v0_8_1"'
++ terraform apply -auto-approve -var=project_id=cloud-ops-sandbox-2091314289 -var=bucket_name=cloud-ops-sandbox-2091314289-bucket -var=skip_ratingservice=false -var=skip_loadgen=false '-var=billing_account=REDACTED' -var=app_version=v0_8_1
╷
│ Error: Invalid provider configuration
│
│ Provider "registry.terraform.io/hashicorp/google" requires explicit configuration. Add a provider block to the root module and configure the provider's required arguments as described in the provider documentation.
│
╵
╷
│ Error: Request cancelled
│
│   with provider["registry.terraform.io/hashicorp/google"],
│   on <empty> line 0:
│   (source code not available)
│
│ The plugin.(*GRPCProvider).ConfigureProvider request was cancelled.
╵
Releasing state lock. This may take a few moments...

Stack trace from the terraform-provider-google_v3.90.0_x5 plugin:

panic: interface conversion: interface {} is nil, not string

goroutine 55 [running]:
github.com/hashicorp/terraform-provider-google/google.GetCurrentUserEmail(0xc0002df800, 0xc000fd20e0, 0x67, 0xc000f42060, 0xc000dbc030, 0x357c660, 0xc000f42060)
        /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-google/google/utils.go:505 +0x1f1
github.com/hashicorp/terraform-provider-google/google.(*Config).logGoogleIdentities(0xc0002df800, 0xc000f2a090, 0xc0005f3130)
        /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-google/google/config.go:465 +0x108
github.com/hashicorp/terraform-provider-google/google.(*Config).LoadAndValidate(0xc0002df800, 0x35aadc0, 0xc000f26300, 0x35aadc0, 0xc000f26300)
        /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-google/google/config.go:375 +0x2cb
github.com/hashicorp/terraform-provider-google/google.providerConfigure(0x35aae68, 0xc000e4fbf0, 0xc000c48980, 0xc00014e2d0, 0x40e198, 0x80, 0x3000060, 0x1, 0xc000c48980)
        /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-google/google/provider.go:1452 +0x2e19
github.com/hashicorp/terraform-provider-google/google.Provider.func1(0x35aae68, 0xc000e4fbf0, 0xc000c48980, 0x0, 0xc000e4fb30, 0x0, 0x0, 0x0)
        /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-google/google/provider.go:811 +0x48
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Provider).Configure(0xc00014e2d0, 0x35aae68, 0xc000e4fbf0, 0xc000e4fb30, 0x2cac740, 0xc000f26300, 0x35aae68)
        /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.5.0/helper/schema/provider.go:286 +0x25c
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ConfigureProvider(0xc000285458, 0x35aadc0, 0xc000f262c0, 0xc000f241b0, 0xc000f262c0, 0x40ba05, 0x2ddafa0)
        /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.5.0/helper/schema/grpc_provider.go:523 +0x3d7
github.com/hashicorp/terraform-plugin-go/tfprotov5/server.(*server).Configure(0xc000a2a3c0, 0x35aae68, 0xc000f262c0, 0xc000f26280, 0xc000a2a3c0, 0xc000e4e1b0, 0xc000a41ba0)
        /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.2.1/tfprotov5/server/server.go:182 +0xcc
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_Configure_Handler(0x2f96dc0, 0xc000a2a3c0, 0x35aae68, 0xc000e4e1b0, 0xc000e6c120, 0x0, 0x35aae68, 0xc000e4e1b0, 0xc0000d4800, 0xaa4)
        /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.2.1/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:326 +0x214
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000230540, 0x35e9218, 0xc000102a80, 0xc000a96ea0, 0xc000653f20, 0x44b5978, 0x0, 0x0, 0x0)
        /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/grpc@v1.40.0/server.go:1297 +0x52b
google.golang.org/grpc.(*Server).handleStream(0xc000230540, 0x35e9218, 0xc000102a80, 0xc000a96ea0, 0x0)
        /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/grpc@v1.40.0/server.go:1626 +0xd0c
google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc000129210, 0xc000230540, 0x35e9218, 0xc000102a80, 0xc000a96ea0)
        /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/grpc@v1.40.0/server.go:941 +0xab
created by google.golang.org/grpc.(*Server).serveStreams.func1
        /opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/google.golang.org/grpc@v1.40.0/server.go:939 +0x1fd

Error: The terraform-provider-google_v3.90.0_x5 plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.
minherz commented 2 years ago

Thank you for reporting the problem. Can you please provide additional information about the problem.

I am looking for information about the environment in which you run the sandboxctl command.

Did you clone the repo? If you did, did you use the main branch or the release tag?

Thank you

mattycourtney commented 2 years ago

After lots of troubleshooting and finding things that didn't work, this seems to be related to https://github.com/hashicorp/terraform-provider-google/issues/13051 and https://issuetracker.google.com/issues/259385802.

So far, deploying from a host that isn't CloudShell seems to be working. Sorry for wasting your time with this.