terraform-provider-kubernetes icon indicating copy to clipboard operation
terraform-provider-kubernetes copied to clipboard

Error with redisinstances.redis.cnrm.cloud.google.com annotation

Open kaeyee opened this issue 4 years ago • 1 comments

Terraform Version, Provider Version and Kubernetes Version

Terraform version: v1.0.5
Kubernetes provider version: v2.5.0
Kubernetes version: v1.20.9-gke.1001

Affected Resource(s)

Terraform Configuration Files

resource "kubernetes_manifest" "redis_cr" {
  depends_on = [null_resource.annotate_namespace]

  manifest = {
    apiVersion = "redis.cnrm.cloud.google.com/v1beta1"
    kind       = "RedisInstance"
    metadata = {
      name      = local.redis_name
      namespace = var.namespace
      annotations = {
        "cnrm.cloud.google.com/project-id" = var.project
      }
    }
    spec = {
      memorySizeGb          = var.memory_size_gb
      region                = var.region
      tier                  = var.tier
      redisVersion          = var.redis_version
      alternativeLocationId = var.alternative_location_id
      authEnabled           = var.auth_enabled
      connectMode           = var.connect_mode
      displayName           = var.display_name
      locationId            = var.location_id
      reservedIpRange       = var.reserved_ip_range
      redisConfigs          = var.redis_configs
      authorizedNetworkRef  = var.authorized_network_ref
    }
  }

  wait_for = {
    fields = {
      # Check the phase of redis cr
      "status.conditions[0].type" = "Ready"

      # Check the status of a redis cr
      "status.conditions[0].status" = "True"
    }
  }
}

Debug Output

Panic Output

╷ │ Error: Plugin did not respond │ │ with kubernetes_manifest.redis_cr, │ on redis_instance.tf line 9, in resource "kubernetes_manifest" "redis_cr": │ 9: resource "kubernetes_manifest" "redis_cr" { │ │ The plugin encountered an error, and failed to respond to the │ plugin.(*GRPCProvider).PlanResourceChange call. The plugin logs may contain │ more details. ╵

Stack trace from the terraform-provider-kubernetes_v2.5.0_x5 plugin:

panic: AttributeName("annotations"): can't use tftypes.Object["cnrm.cloud.google.com/management-conflict-prevention-policy":tftypes.String, "cnrm.cloud.google.com/project-id":tftypes.String] as tftypes.Object["cnrm.cloud.google.com/project-id":tftypes.String]

goroutine 573 [running]: github.com/hashicorp/terraform-plugin-go/tftypes.NewValue(...) /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-kubernetes/vendor/github.com/hashicorp/terraform-plugin-go/tftypes/value.go:267 github.com/hashicorp/terraform-plugin-go/tftypes.transform(0xc000f9c6c0, 0x329da30, 0xc00df7f9e0, 0x2c24660, 0xc00df7ee10, 0xc008ed98a0, 0x0, 0x1, 0x2b647e0, 0xc00df4e600, ...) /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-kubernetes/vendor/github.com/hashicorp/terraform-plugin-go/tftypes/walk.go:170 +0x1bd1 github.com/hashicorp/terraform-plugin-go/tftypes.transform(0xc000f9c540, 0x329da30, 0xc0095cb320, 0x2c24660, 0xc0095c5da0, 0xc008ed98a0, 0x1, 0x2, 0xc0095cb320, 0x2c24660, ...) /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-kubernetes/vendor/github.com/hashicorp/terraform-plugin-go/tftypes/walk.go:163 +0x13a5 github.com/hashicorp/terraform-plugin-go/tftypes.Transform(...) /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-kubernetes/vendor/github.com/hashicorp/terraform-plugin-go/tftypes/walk.go:112 github.com/hashicorp/terraform-provider-kubernetes/manifest/provider.(*RawProviderServer).PlanResourceChange(0xc000eac480, 0x328f948, 0xc00de2eb40, 0xc0000a6730, 0xc000f5e3b8, 0x1, 0x30) /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-kubernetes/manifest/provider/plan.go:385 +0x2825 github.com/hashicorp/terraform-plugin-mux.SchemaServer.PlanResourceChange(0xc000fd4a50, 0xc000fd4a80, 0xc00123cb80, 0x2, 0x2, 0xc000eac380, 0x1, 0x328f948, 0xc00de2eb40, 0xc0000a6730, ...) /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-kubernetes/vendor/github.com/hashicorp/terraform-plugin-mux/schema_server.go:276 +0x98 github.com/hashicorp/terraform-plugin-go/tfprotov5/server.(*server).PlanResourceChange(0xc00123cba0, 0x328f9f0, 0xc00de2eb40, 0xc00dfc0000, 0xc00123cba0, 0xc00dfa79e0, 0xc001499ba0) /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-kubernetes/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/server/server.go:315 +0xb5 github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_PlanResourceChange_Handler(0x2e01f20, 0xc00123cba0, 0x328f9f0, 0xc00dfa79e0, 0xc0015105a0, 0x0, 0x328f9f0, 0xc00dfa79e0, 0xc00dfab980, 0x1955) /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-kubernetes/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:362 +0x214 google.golang.org/grpc.(*Server).processUnaryRPC(0xc000234e00, 0x32a7778, 0xc000602600, 0xc00de32ea0, 0xc000fd4b10, 0x4112c88, 0x0, 0x0, 0x0) /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-kubernetes/vendor/google.golang.org/grpc/server.go:1217 +0x52b google.golang.org/grpc.(*Server).handleStream(0xc000234e00, 0x32a7778, 0xc000602600, 0xc00de32ea0, 0x0) /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-kubernetes/vendor/google.golang.org/grpc/server.go:1540 +0xd0c google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc0008a6970, 0xc000234e00, 0x32a7778, 0xc000602600, 0xc00de32ea0) /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-kubernetes/vendor/google.golang.org/grpc/server.go:878 +0xab created by google.golang.org/grpc.(*Server).serveStreams.func1 /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-kubernetes/vendor/google.golang.org/grpc/server.go:876 +0x1fd

Error: The terraform-provider-kubernetes_v2.5.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.

ERRO[0019] Hit multiple errors: Hit multiple errors: exit status 1

Steps to Reproduce

panice

Expected Behavior

What should have happened? annotation cnrm.cloud.google.com/management-conflict-prevention-policy is added by GCP, Terraform should not validate this.

Actual Behavior

What actually happened? Terraform check the annotation with the spec, and expect only "cnrm.cloud.google.com/project-id", when "cnrm.cloud.google.com/management-conflict-prevention-policy" is also present, panic happen.

Important Factoids

References

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

kaeyee avatar Sep 24 '21 13:09 kaeyee

Marking this issue as stale due to inactivity. If this issue receives no comments in the next 30 days it will automatically be closed. If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. This helps our maintainers find and focus on the active issues. Maintainers may also remove the stale label at their discretion. Thank you!

github-actions[bot] avatar Sep 25 '22 00:09 github-actions[bot]

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

github-actions[bot] avatar Nov 24 '22 02:11 github-actions[bot]