Plugin Crash Creating octopusdeploy_deployment_target
Describe the bug The Plugin in crashing attempting to create or update a octopusdeploy_deployment_target resource. This is attempting to use an AWS EKS cluster for the deployment target using IAM role assumption
Terraform Resource
environments = [octopusdeploy_environment.this.id] # the environment is created successfully
name = "Test"
roles = ["some_role"]
endpoint {
communication_style = "Kubernetes"
cluster_certificate = "Certificates-X"
cluster_url = "MY_EKS_URL"
default_worker_pool_id = "WorkerPools-X"
namespace = "default"
authentication {
account_id = octopusdeploy_aws_account.this.id # the account is created successfully
assumed_role_arn = "my_assume_role"
authentication_type = "KubernetesAws"
assume_role = true
assume_role_session_duration = 3600
assumed_role_session = "something"
cluster_name = "my-cluster-name"
impersonate_service_account = false
use_instance_role = false
use_vm_service_account = false
}
}
}
Expected behavior Resource is updated or reports invalid configuration
Logs and other supporting information
octopusdeploy_deployment_target.this: Modifying... [id=Machines-X]
╷
│ Error: Plugin did not respond
│
│ with octopusdeploy_deployment_target.this,
│ on octopus.tf line 96, in resource "octopusdeploy_deployment_target" "this":
│ 96: resource "octopusdeploy_deployment_target" "this" {
│
│ 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.7.60 plugin:
panic: interface conversion: interface {} is map[string]interface {}, not []interface {}
goroutine 24 [running]:
github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy.expandKubernetesAwsAuthentication({0x180db60, 0xc000bd4810})
github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy/schema_kubernetes_aws_authentication.go:9 +0x467
github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy.expandKubernetesAuthentication({0x18c7a20, 0xc000bc4600})
github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy/schema_kubernetes_authentication.go:24 +0x15a
github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy.expandKubernetesCluster(0x180db60)
github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy/schema_kubernetes_cluster.go:13 +0x145
github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy.expandEndpoint({0x17c3560, 0xc000bda930})
github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy/schema_endpoint.go:30 +0x330
github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy.expandDeploymentTarget(0xc000913300)
github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy/schema_deployment_target.go:13 +0x8a
github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy.resourceDeploymentTargetUpdate({0x1a2e008, 0xc0005d1e00}, 0xc000913300, {0x17ab8e0, 0xc000129b80})
github.com/OctopusDeploy/terraform-provider-octopusdeploy/octopusdeploy/resource_deployment_target.go:74 +0x17d
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).update(0xc000475dc0, {0x1a2df98, 0xc0006479c0}, 0x24, {0x17ab8e0, 0xc000129b80})
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:364 +0x12e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc000475dc0, {0x1a2df98, 0xc0006479c0}, 0xc0008cda00, 0xc000912f80, {0x17ab8e0, 0xc000129b80})
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:464 +0x6ba
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc00000c210, {0x1a2df98, 0xc0006479c0}, 0xc0005ae500)
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:977 +0xd8a
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc00009aee0, {0x1a2e040, 0xc0006a2450}, 0x0)
github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:332 +0x6c
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x18c1080, 0xc00009aee0}, {0x1a2e040, 0xc0006a2450}, 0xc0005d0b40, 0x0)
github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:380 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000648540, {0x1a3cfd0, 0xc000164d80}, 0xc000907680, 0xc0003c6d50, 0x1fd4480, 0x0)
google.golang.org/[email protected]/server.go:1282 +0xccf
google.golang.org/grpc.(*Server).handleStream(0xc000648540, {0x1a3cfd0, 0xc000164d80}, 0xc000907680, 0x0)
google.golang.org/[email protected]/server.go:1616 +0xa2a
google.golang.org/grpc.(*Server).serveStreams.func1.2()
google.golang.org/[email protected]/server.go:921 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
google.golang.org/[email protected]/server.go:919 +0x294
Error: The terraform-provider-octopusdeploy_v0.7.60 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.
Environment and versions:
- OS:
OSX - Octopus Server Version:
cloud - Terraform Version:
1.0.10 - Octopus Terraform Provider Version:
0.7.60
Hey @DanielMolander! :wave: I would suggest moving this configuration into the octopusdeploy_kubernetes_cluster_deployment_target resource; it offers better validation than the generic octopusdeploy_deployment_target resource:
resource "octopusdeploy_kubernetes_cluster_deployment_target" "k8s-target" {
cluster_url = "https://example.com/xyz"
environments = ["Environments-123"]
name = "k8s-target-name"
roles = ["UserRoles-123"]
tenanted_deployment_participation = "Untenanted"
aws_account_authentication {
account_id = "Accounts-123"
cluster_name = "cluster-name"
}
}
In the meantime, I will investigate this bug.
Using the latest version 0.10.3 it works when created via octopusdeploy_kubernetes_cluster_deployment_target
I will close this issue.