Skip to content

Crash of terraform provider during update of cleanup_policies #21900

Closed
@AndreiBrajnicov

Description

@AndreiBrajnicov

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to a user, that user is claiming responsibility for the issue.
  • Customers working with a Google Technical Account Manager or Customer Engineer can ask them to reach out internally to expedite investigation and resolution of this issue.

Terraform Version & Provider Version(s)

Terraform terraform-provider-google-beta_v6.25.0_x5
on arm64 ( Mac M)

...
├── provider[registry.terraform.io/hashicorp/google] >= 6.25.0
└── module.artifact_registry
    ├── provider[registry.terraform.io/hashicorp/google] >= 5.26.0, < 7.0.0
    └── provider[registry.terraform.io/hashicorp/google-beta] >= 5.26.0, < 7.0.0
...

Affected Resource(s)

It is impossible to update/delete cleanup_policies from "GoogleCloudPlatform/artifact-registry/google" module.
The provider is crashing

Terraform Configuration

module "artifact_registry" {
  source  = "GoogleCloudPlatform/artifact-registry/google"
  version = "~> 0.3"

  for_each     = toset(var.registry_repositories)
  project_id    = var.project_id
  location      = var.region
  format        = "docker"
  repository_id = each.key
  mode = "STANDARD_REPOSITORY"


  # cleanup_policies = {
  #   "delete-untagged-older-than-10d" = {
  #     action = "DELETE"
  #     condition = {
  #       older_than            = "10d"
  #       tag_state             = "UNTAGGED"
  #     }
  #   }
  # }
}


variable "registry_repositories" {
  type    = list(string)
  default = ["repo1", "repo2", "repo3"]
}

Debug Output

No response

Expected Behavior

I'm able to update/delete cleanup_policies

Actual Behavior

During an attempt to delete/update cleanup_policies , terraform provider is crashing:

Plan: 0 to add, 3 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

module.artifact_registry["repo1"].google_artifact_registry_repository.repo: Modifying... [id=projects/censored-project-name/locations/europe-central2/repositories/repo1]
module.artifact_registry["repo2"].google_artifact_registry_repository.repo: Modifying... [id=projects/censored-project-name/locations/europe-central2/repositories/repo2]
module.artifact_registry["repo3"].google_artifact_registry_repository.repo: Modifying... [id=projects/censored-project-name/locations/europe-central2/repositories/repo3]
╷
│ Error: Plugin did not respond
│
│   with module.artifact_registry["repo2"].google_artifact_registry_repository.repo,
│   on .terraform/modules/artifact_registry/main.tf line 17, in resource "google_artifact_registry_repository" "repo":
│   17: resource "google_artifact_registry_repository" "repo" {
│
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more
│ details.
╵
╷
│ Error: Plugin did not respond
│
│   with module.artifact_registry["repo1"].google_artifact_registry_repository.repo,
│   on .terraform/modules/artifact_registry/main.tf line 17, in resource "google_artifact_registry_repository" "repo":
│   17: resource "google_artifact_registry_repository" "repo" {
│
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more
│ details.
╵
╷
│ Error: Plugin did not respond
│
│   with module.artifact_registry["repo3"].google_artifact_registry_repository.repo,
│   on .terraform/modules/artifact_registry/main.tf line 17, in resource "google_artifact_registry_repository" "repo":
│   17: resource "google_artifact_registry_repository" "repo" {
│
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more
│ details.
╵

Stack trace from the terraform-provider-google-beta_v6.25.0_x5 plugin:

panic: interface conversion: interface {} is nil, not map[string]interface {}

goroutine 276 [running]:
github.com/hashicorp/terraform-provider-google-beta/google-beta/services/artifactregistry.mapHashID({0x0?, 0x0?})
	github.com/hashicorp/terraform-provider-google-beta/google-beta/services/artifactregistry/resource_artifact_registry_repository.go:121 +0x94
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Set).hash(0x1400321b7c0?, {0x0?, 0x0?})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/set.go:221 +0x34
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Set).add(0x14003383160, {0x0, 0x0}, 0x0)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/set.go:201 +0x6c
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ConfigFieldReader).readSet(0x140033bc930, {0x140033c99a0, 0x1, 0x1}, 0x1400321a780)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/field_reader_config.go:287 +0x298
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ConfigFieldReader).readField(0x140033bc930, {0x140033c99a0, 0x1, 0x1}, 0x0)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/field_reader_config.go:110 +0x320
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ConfigFieldReader).ReadField(0x108472760?, {0x140033c99a0?, 0x1076c5dee?, 0x6?})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/field_reader_config.go:32 +0x84
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*MultiLevelFieldReader).ReadFieldExact(0x140033c9990?, {0x140033c99a0, 0x1, 0x1}, {0x1076c5dee, 0x6})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/field_reader_multi.go:34 +0x78
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).get(0x140033c0080, {0x140033c99a0, 0x1, 0x1}, 0x0?)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource_data.go:554 +0xfc
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).getChange(0x140033c0080, {0x1076e8aed?, 0x10?}, 0x1?, 0x12)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource_data.go:530 +0x150
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).diffChange(0x14001eb0b98?, {0x1076e8aed?, 0x98?})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource_data.go:507 +0x44
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.diffSet(0x140030f6f90, {0x108bca628, 0x140030d6360}, {0x1076e8aed, 0x10}, 0x1400321a780, 0x14001eb0f68, {0x108bd3bb0, 0x140033c0080}, 0x0)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/schema.go:1456 +0x5c
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.diff(0x140030f6f90, {0x108bca628, 0x140030d6360}, {0x1076e8aed, 0x10}, 0x1400321a780, 0x140033c0000, {0x108bd3bb0, 0x140033c0080}, 0x0)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/schema.go:1178 +0x180
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.Diff(0x140030f6f90, {0x108bca628, 0x140030d6360}, 0x14003218d00, 0x1400339d360, 0x0, {0x0, 0x0}, 0x0)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/schema.go:690 +0x298
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.diffFromValues({0x108bca628, 0x140030d6360}, {{{0x108bcab68?, 0x14002f3b810?}}, {0x10846ef80?, 0x140030e0810?}}, {{{0x108bcab68?, 0x14002f3b920?}}, {0x10846ef80?, 0x140030e1650?}}, ...)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/shims.go:46 +0x208
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.DiffFromValues(...)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/shims.go:23
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0x1400000ce40, {0x108bca628?, 0x140030d62a0?}, 0x14002ddbbd0)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1128 +0x500
github.com/hashicorp/terraform-plugin-mux/tf5muxserver.(*muxServer).ApplyResourceChange(0x140003aea00, {0x108bca628?, 0x140030c5f50?}, 0x14002ddbbd0)
	github.com/hashicorp/[email protected]/tf5muxserver/mux_server_ApplyResourceChange.go:36 +0x184
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0x14000800c80, {0x108bca628?, 0x14003118810?}, 0x14002fe55e0)
	github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:866 +0x2a8
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x108b0f480, 0x14000800c80}, {0x108bca628, 0x14003118810}, 0x14003116680, 0x0)
	github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:611 +0x1c0
google.golang.org/grpc.(*Server).processUnaryRPC(0x140001a5400, {0x108bca628, 0x1400305f020}, 0x14002d7ede0, 0x140006fa2a0, 0x10aca4a78, 0x0)
	google.golang.org/[email protected]/server.go:1400 +0xca8
google.golang.org/grpc.(*Server).handleStream(0x140001a5400, {0x108bcaef0, 0x1400100a4e0}, 0x14002d7ede0)
	google.golang.org/[email protected]/server.go:1810 +0x910
google.golang.org/grpc.(*Server).serveStreams.func2.1()
	google.golang.org/[email protected]/server.go:1030 +0x84
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 29
	google.golang.org/[email protected]/server.go:1041 +0x13c

Error: The terraform-provider-google-beta_v6.25.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.

Steps to reproduce

  1. terraform apply

Important Factoids

No response

References

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions