hashicorp / terraform-provider-google

Terraform Provider for Google Cloud Platform
https://registry.terraform.io/providers/hashicorp/google/latest/docs
Mozilla Public License 2.0
2.32k stars 1.73k forks source link

The terraform-provider-google_v5.36.0_x5.exe plugin crashed! - gcs_bucket amendments #18647

Open AdamBriers opened 3 months ago

AdamBriers commented 3 months ago

Community Note

Terraform Version & Provider Version(s)

Terraform v1.7.3 on

Affected Resource(s)

resource "google_storage_bucket" and accompanied terragrunt.hcl

Terraform Configuration

  source = "../../../../modules//opinionated_gcs_bucket/"
}

include {
  path = find_in_parent_folders("org.hcl")
}

dependency "project" {
  config_path = "../"

  # Configure mock outputs for the terraform commands that are returned when there are no outputs available (e.g the
  # module hasn't been applied yet.
  mock_outputs_allowed_terraform_commands = ["plan", "validate"]
  mock_outputs = {
    project_id = "project-not-created-yet"
  }
}

inputs = {
  project_id        = dependency.project.outputs.project_id
  name              = "sqlprod_backups"
  location          = "europe-west2"
  storage_class     = "REGIONAL"
  retention_period  = 2592000
  versioning        = false

  lifecycle_rules = [{
    age           = 8
    storage_class = "NEARLINE"
  }]
  access = {
    "roles/storage.objectCreator" = [
      "serviceAccount:REDACTED"
    ]
  }
}

Debug Output

Planning failed. Terraform encountered an error while generating this plan.

╷ │ Warning: Value for undeclared variable │ │ The root module does not declare a variable named "org_id" but a value was │ found in file "C:/Cloudrepos/placesforpeople/org/org.tfvars". If you meant │ to use this value, add a "variable" block to the configuration. │ │ To silence these warnings, use TFVAR... environment variables to provide │ certain "global" settings to all configurations in your organization. To │ reduce the verbosity of these warnings, use the -compact-warnings option. ╵ ╷ │ Warning: Value for undeclared variable │ │ The root module does not declare a variable named "host_project_id" but a │ value was found in file "C:/Cloudrepos/placesforpeople/org/org.tfvars". If │ you meant to use this value, add a "variable" block to the configuration. │ │ To silence these warnings, use TFVAR... environment variables to provide │ certain "global" settings to all configurations in your organization. To │ reduce the verbosity of these warnings, use the -compact-warnings option. ╵ ╷ │ Warning: Values for undeclared variables │ │ In addition to the other similar warnings shown, 1 other variable(s) │ defined without being declared. ╵ ╷ │ Error: Plugin did not respond │ │ with google_storage_bucket.this, │ on main.tf line 5, in resource "google_storage_bucket" "this": │ 5: resource "google_storage_bucket" "this" { │ │ The plugin encountered an error, and failed to respond to the │ plugin.(*GRPCProvider).ReadResource call. The plugin logs may contain more │ details. ╵

Stack trace from the terraform-provider-google_v5.36.0_x5.exe plugin:

panic: Error reading level state: strconv.ParseInt: parsing "379160375214": value out of range

goroutine 42 [running]: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(ResourceData).get(0x11c18730, {0x11c03d30, 0x1, 0x1}, 0x8) github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/resource_data.go:556 +0x299 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(ResourceData).State(0x11c18730) github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/resource_data.go:354 +0x463 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(Resource).ShimInstanceStateFromValue(0x118b0150, {{{0x4e6c7c8, 0x11c02cf0}}, {0x4173680, 0x11c48040}}) github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/resource.go:670 +0x1e8 github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(GRPCProviderServer).ReadResource(0x118bc530, {0x4e6c3a8, 0x11c12480}, 0x11854480) github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/grpc_provider.go:641 +0x238 github.com/hashicorp/terraform-plugin-mux/tf5muxserver.(muxServer).ReadResource(0x113475e0, {0x4e6c3a8, 0x11c123a8}, 0x11854480) github.com/hashicorp/terraform-plugin-mux@v0.15.0/tf5muxserver/mux_server_ReadResource.go:35 +0x1df github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(server).ReadResource(0x113469b0, {0x4e6c3a8, 0x11c120d8}, 0x11c14090) github.com/hashicorp/terraform-plugin-go@v0.22.1/tfprotov5/tf5server/server.go:775 +0x4b3 github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadResource_Handler({0x46e5ac0, 0x113469b0}, {0x4e6c3a8, 0x11c120d8}, 0x11418140, 0x0) github.com/hashicorp/terraform-plugin-go@v0.22.1/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:482 +0x176 google.golang.org/grpc.(Server).processUnaryRPC(0x11324640, {0x4e6c3a8, 0x11c120a8}, {0x4e7185c, 0x11384d00}, 0x11c1a0a0, 0x1187d3c8, 0x695c0d4, 0x0) google.golang.org/grpc@v1.64.0/server.go:1379 +0xf89 google.golang.org/grpc.(Server).handleStream(0x11324640, {0x4e7185c, 0x11384d00}, 0x11c1a0a0) google.golang.org/grpc@v1.64.0/server.go:1790 +0x1108 google.golang.org/grpc.(Server).serveStreams.func2.1() google.golang.org/grpc@v1.64.0/server.go:1029 +0xab created by google.golang.org/grpc.(Server).serveStreams.func2 in goroutine 38 google.golang.org/grpc@v1.64.0/server.go:1040 +0x13f

Error: The terraform-provider-google_v5.36.0_x5.exe 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.

time=2024-07-03T17:09:42+01:00 level=error msg=terraform invocation failed in C:/.terragrunt-cache/-N_dMeJ_V3_sBho8siZW6vrSIS0/xNhE74xaa7fgwnaLoGZW2JIeTK4/opinionated_gcs_bucket error=[C:/.terragrunt-cache/-N_dMeJ_V3_sBho8siZW6vrSIS0/xNhE74xaa7fgwnaLoGZW2JIeTK4/opinionated_gcs_bucket] exit status 1 prefix=[C:\Cloudrepos\placesforpeople\org\prd\databases\backups] time=2024-07-03T17:09:42+01:00 level=error msg=1 error occurred:

Expected Behavior

Initially wanted to add a delete_after lifecycle rule which supplied the same error, changing back to the above code also now generates the same error.

Actual Behavior

See debug error

Steps to reproduce

  1. terragrunt init
  2. terragrunt plan

Important Factoids

No response

References

It looks like something similar was raised under #18569

ggtisc commented 3 months ago

Hi @AdamBriers!

Please confirm us if the version of terraform you have matches with your OS. You could achive this with a terraform -version looking for the OS