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

Polling tentacle deployment target can have no changes applied after initial creation of resource

Open harrisonmeister opened this issue 1 year ago • 0 comments

Describe the bug When creating an octopusdeploy_polling_tentacle_deployment_target resource, any subsequent changes to the resource cause an error.

Plan: 0 to add, 1 to change, 0 to destroy.
octopusdeploy_polling_tentacle_deployment_target.poll_target_db02: Modifying... [id=Machines-371]
╷
│ Error: Plugin did not respond
│ 
│   with octopusdeploy_polling_tentacle_deployment_target.poll_target_db02,
│   on polling_targets.tf line 56, in resource "octopusdeploy_polling_tentacle_deployment_target" "poll_target_db02":
│   56: resource "octopusdeploy_polling_tentacle_deployment_target" "poll_target_db02" {
│ 
│ 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-octopusdeploy_v0.12.0 plugin:

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

Steps to reproduce

  1. Create an octopusdeploy_polling_tentacle_deployment_target resource, example:
resource "octopusdeploy_polling_tentacle_deployment_target" "poll_target_db02" {
  provider                          = octopusdeploy.support_space
  name                              = "db02-local"
  environments                      = ["Environments-1"]
  is_disabled                       = false
  machine_policy_id                 = "MachinePolicies-142"
  roles                             = ["db-server"]
  tenanted_deployment_participation = "TenantedOrUntenanted"
  tentacle_url                      = "poll://ghfytgwjuycbjsy67cns/"
  thumbprint                        = "657D9E2509071CEC2350D25AA4489264A7893DDC"
}
  1. Run terraform apply
  2. Update the resource above, any property can change. The simplest is the roles array.
resource "octopusdeploy_polling_tentacle_deployment_target" "poll_target_db02" {
  provider                          = octopusdeploy.support_space
  name                              = "db02-local"
  environments                      = ["Environments-1"]
  is_disabled                       = false
  machine_policy_id                 = "MachinePolicies-142"
  roles                             = ["db-server", "randomquotes-web"]
  tenanted_deployment_participation = "TenantedOrUntenanted"
  tentacle_url                      = "poll://ghfytgwjuycbjsy67cns/"
  thumbprint                        = "657D9E2509071CEC2350D25AA4489264A7893DDC"
}
  1. Run terraform apply again (second time)
  2. See error:
Plan: 0 to add, 1 to change, 0 to destroy.
octopusdeploy_polling_tentacle_deployment_target.poll_target_db02: Modifying... [id=Machines-400]
╷
│ Error: Plugin did not respond
│ 
│   with octopusdeploy_polling_tentacle_deployment_target.poll_target_db02,
│   on polling_targets.tf line 49, in resource "octopusdeploy_polling_tentacle_deployment_target" "poll_target_db02":
│   49: resource "octopusdeploy_polling_tentacle_deployment_target" "poll_target_db02" {
│ 
│ 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-octopusdeploy_v0.12.0 plugin:

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

goroutine 113 [running]:
github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy.expandPollingTentacle(0xd4a060?)
        github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy/schema_polling_tentacle.go:10 +0x589
github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy.expandEndpoint({0xcf50c0?, 0xc00034db00?})
        github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy/schema_endpoint.go:38 +0x6b0
github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy.expandDeploymentTarget(0xc000ab9300)
        github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy/schema_deployment_target.go:14 +0x8a
github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy.expandPollingTentacleDeploymentTarget(0xe958ac?)
        github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy/schema_polling_tentacle_deployment_target.go:26 +0x439
github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy.resourcePollingTentacleDeploymentTargetUpdate({0xfbc168, 0xc000ad3530}, 0xc000ab9300, {0xd6a520?, 0xc0004eb600})
        github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy/resource_polling_tentacle_deployment_target.go:80 +0x12f
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).update(0xc0007c27e0, {0xfbc1a0, 0xc000f22ea0}, 0xd?, {0xd6a520, 0xc0004eb600})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:741 +0x12e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc0007c27e0, {0xfbc1a0, 0xc000f22ea0}, 0xc000a6f040, 0xc000ab9180, {0xd6a520, 0xc0004eb600})
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:847 +0x845
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc00034cd80, {0xfbc1a0?, 0xc000f22d80?}, 0xc0003951d0)
        github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1021 +0xe8d
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc0000c0b40, {0xfbc1a0?, 0xc000f22330?}, 0xc0000ea150)
        github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:818 +0x574
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0xe1d740?, 0xc0000c0b40}, {0xfbc1a0, 0xc000f22330}, 0xc0000ea0e0, 0x0)
        github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:385 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0003b8000, {0xfc2058, 0xc000602680}, 0xc000c34000, 0xc000743950, 0x15c2320, 0x0)
        google.golang.org/[email protected]/server.go:1340 +0xd33
google.golang.org/grpc.(*Server).handleStream(0xc0003b8000, {0xfc2058, 0xc000602680}, 0xc000c34000, 0x0)
        google.golang.org/[email protected]/server.go:1713 +0xa36
google.golang.org/grpc.(*Server).serveStreams.func1.2()
        google.golang.org/[email protected]/server.go:965 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/[email protected]/server.go:963 +0x28a

Error: The terraform-provider-octopusdeploy_v0.12.0 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.

Expected behavior The terraform change to be applied, and no error to appear

Environment and versions:

  • OS: Ubuntu 22.04
  • Octopus Server Version: 2023.2.8159 (Cloud)
  • Terraform Version: v1.4.6
  • Octopus Terraform Provider Version: 0.12.0

harrisonmeister avatar Apr 28 '23 09:04 harrisonmeister