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

Recreating a deleted k8s_credentials resources leads to a 404

Open franznemeth opened this issue 2 years ago • 1 comments

We are using the k8s_credentials resource to add our EKS clusters to dynatrace.

When deleting the kubernetes connection outside of terraform, terraform is not able to run through until you recreate it manually.

module.somemodule.kubernetes_service_account.dynatrace_kubernetes_monitoring: Refreshing state... [id=default/dynatrace-kubernetes-monitoring] This is the output I get from terraform plan

│ Error: {
│   "code": 404,
│   "message": "Configuration 'KUBERNETES_CLUSTER+SOMEID' not found.",
│   "constraintViolations": null
│ }
│
│

This is the terraform configuration in question:

resource "dynatrace_k8s_credentials" "this" {
  label                               = var.cluster_name
  active                              = true
  auth_token                          = "sometoken"
  events_integration_enabled          = true
  davis_events_integration_enabled    = true
  certificate_check_enabled           = false
  endpoint_url                        = "someendpoint"
  event_analysis_and_alerting_enabled = true
  prometheus_exporters                = true
  workload_integration_enabled        = true
  events_field_selectors {
    active         = true
    field_selector = "involvedObject.kind=Node"
    label          = "Node events"
  }
  events_field_selectors {
    active         = true
    field_selector = "involvedObject.kind=Pod,type=Warning"
    label          = "Pod warning Events"
  }
}

I would expect the terraform module to try to recreate the connection in case it was removed outside of terraform

franznemeth avatar Dec 16 '21 14:12 franznemeth