buildkite / terraform-provider-buildkite

Terraform provider for Buildkite
https://registry.terraform.io/providers/buildkite/buildkite/latest
MIT License
56 stars 35 forks source link

Provider does not recover if cluster queue is deleted outside Terraform #567

Closed bpoland closed 1 month ago

bpoland commented 1 month ago

Describe the bug If Terraformed cluster queue is deleted manually in the UI, Terraform plan will fail with this error:

│ Error: Unable to find Cluster Queue
│ 
│   with buildkite_cluster_queue.example,
│   on example.tf line 5, in resource "buildkite_cluster_queue" "example":
│    5: resource "buildkite_cluster_queue" "this" {
│ 
│ Unable to find any queues for cluster:
│ "<redacted_base64>"
╵
Unexpected exit code when planning changes: 1

To Reproduce Steps to reproduce the behavior:

  1. Terraform a cluster queue and apply
  2. Delete the queue in the Buildkite UI
  3. Run a terraform plan, it will fail with the above error

Expected behavior Terraform should notice that the resource has been deleted and offer to recreate it since the actual state does not match the desired state

Additional context I ran into this issue after manually recovering from the issue in https://github.com/buildkite/terraform-provider-buildkite/issues/566 since I had to manually delete some queues to solve that. I then had to manually terraform state rm the queues I had deleted in the UI in order to get past this issue 😬