IBM-Cloud / terraform-provider-ibm

https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs
Mozilla Public License 2.0
342 stars 673 forks source link

ibm_schematics_agent_deploy doesn't delete the deployed schematics agent on the terraform destroy #5475

Open rajatagarwal-ibm opened 5 months ago

rajatagarwal-ibm commented 5 months ago

Community Note

Terraform CLI and Terraform IBM Provider Version

Affected Resource(s)

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

resource "ibm_schematics_agent" "schematics_agent_instance" {
  agent_infrastructure {
    infra_type             =  "ibm_kubernetes"
    cluster_id             =   var.cluster_id
    cluster_resource_group = var.cluster_resource_group_id
    cos_instance_name      = var.cos_instance_name
    cos_bucket_name        = var.cos_bucket_name
    cos_bucket_region      = var.cos_bucket_region
  }
  agent_location      = var.agent_location
  description         = var.agent_description
  name                = var.agent_name
  resource_group      = var.agent_resource_group_id
  schematics_location = var.schematics_location
  version             = var.agent_version
}

resource "ibm_schematics_agent_deploy" "schematics_agent_deploy" {
  agent_id = ibm_schematics_agent.schematics_agent_instance.id
}

Debug Output

module.schematics_agent.ibm_schematics_agent.schematics_agent_instance: Destroying... [id=rajat-sa-agent.soA.68eb]
β•·
β”‚ Error: DeleteAgentDataWithContext failed Error while deleting the agent, agent provisioned resources are not destroyed completely
β”‚ {
β”‚     "StatusCode": 412,
β”‚     "Headers": {
β”‚         "Cache-Control": [
β”‚             "no-store, no-cache='Set-Cookie, Set-Cookie2', must-revalidate, proxy-revalidate, post-check=0, pre-check=0"
β”‚         ],
β”‚         "Cf-Cache-Status": [
β”‚             "DYNAMIC"
β”‚         ],
β”‚         "Cf-Ray": [
β”‚             "89a458ef4e4c3a9a-FRA"
β”‚         ],
β”‚         "Content-Length": [
β”‚             "235"
β”‚         ],
β”‚         "Content-Security-Policy": [
β”‚             "default-src 'self'; frame-ancestors 'self';"
β”‚         ],
β”‚         "Content-Type": [
β”‚             "application/json; charset=utf-8"
β”‚         ],
β”‚         "Date": [
β”‚             "Thu, 27 Jun 2024 09:18:02 GMT"
β”‚         ],
β”‚         "Expires": [
β”‚             "0"
β”‚         ],
β”‚         "Ibm-Schematics-Requestid": [
β”‚             "e69a877e-2f42-485c-820c-4a16a33e08de"
β”‚         ],
β”‚         "Pragma": [
β”‚             "no-cache"
β”‚         ],
β”‚         "Server": [
β”‚             "cloudflare"
β”‚         ],
β”‚         "Strict-Transport-Security": [
β”‚             "max-age=15552000; includeSubDomains"
β”‚         ],
β”‚         "X-Content-Type-Options": [
β”‚             "nosniff"
β”‚         ],
β”‚         "X-Xss-Protection": [
β”‚             "1; mode=block"
β”‚         ]
β”‚     },
β”‚     "Result": {
β”‚         "message": "Error while deleting the agent, agent provisioned resources are not destroyed completely",
β”‚         "messageid": "M1208",
β”‚         "requestid": "e69a877e-2f42-485c-820c-4a16a33e08de",
β”‚         "statuscode": 412,
β”‚         "timestamp": "2024-06-27T09:18:02.935390492Z"
β”‚     },
β”‚     "RawResult": null
β”‚ }
β”‚ 
β”‚ 
β”‚ 
β•΅

Panic Output

Expected Behavior

It should delete the schematics agent deployed on the Kubernetes cluster.

Actual Behavior

It doesn't delete the schematics agent deployed on the Kubernetes cluster. I spoke with one of the engineer in Schematics and learned it has been implemented in API and CLI but not in the terraform yet.

Steps to Reproduce

  1. terraform apply the above code
  2. terraform destroy.

Important Factoids

References

VaishnaviGopal commented 1 month ago

The issue is now handled in the latest release 1.70.0 Can you test it now?