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

`plan`/`apply` raises 404 on `prefect_work_pool` if work pool is deleted outside Terraform

Open kevingrismore opened this issue 5 months ago • 0 comments

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Terraform Version

Terraform v1.9.5
on darwin_arm64
+ provider registry.terraform.io/prefecthq/prefect v2.2.2

Affected Resource(s)

  • prefect_work_pool

Terraform Configuration Files

resource "prefect_work_pool" "example" {
  name              = "test-k8s-pool"
  type              = "kubernetes"
  workspace_id      = "<workspace-id>"
  paused            = false
  base_job_template = file("./base-job-template.json")
}

Debug Output

Panic Output

Expected Behavior

After creating a work pool with Terraform, then deleting it through the Prefect UI, Terraform should detect that the work pool doesn't exist & try to recreate it.

Actual Behavior

After creating a work pool with Terraform, then deleting it through the Prefect UI, Terraform raises a 404.

│ Error: Error during get Work Pool
│ 
│   with prefect_work_pool.example,
│   on work_pool.tf line 3, in resource "prefect_work_pool" "example":
│    3: resource "prefect_work_pool" "example" {
│ 
│ Could not get Work Pool, unexpected error: status code 404 Not Found, error={"detail":"Work pool \"test-k8s-pool\" not found."}

Steps to Reproduce

  1. Define a work pool resource
  2. terraform apply
  3. Delete the work pool from the Prefect UI
  4. terraform apply

Important Factoids

References

kevingrismore avatar Sep 19 '24 19:09 kevingrismore