PaloAltoNetworks / terraform-provider-prismacloud

Terraform PrismaCloud provider
https://www.terraform.io/docs/providers/prismacloud/
Mozilla Public License 2.0
54 stars 65 forks source link

Error: 404 error without the "X-Redlock-Status" header - returned HTML: (blank) #272

Closed erikpaasonen closed 5 months ago

erikpaasonen commented 11 months ago

Describe the bug

Certain prismacloud_cloud_account_v2 resources now throwing this error after previously succeeding:

Error running terraform plan with prismacloud_cloud_account_v2.account[0], on prismacloud.tf line 10, in resource "prismacloud_cloud_account_v2" "account": Error: 404 error without the "X-Redlock-Status" header - returned HTML:

(The absence of any actual HTML code seems to indicate the body of the 404 was empty.)

Expected behavior

Terraform should plan and apply without error. If the cloud account has been deleted outside of Terraform, then Terraform should recognize that the resource needs to be recreated and recreate it.

Current behavior

The Terraform plan errors out with the error message given above.

Possible solution

Steps to reproduce

  1. create prismacloud_cloud_account_v2 resource
  2. run terraform apply
  3. confirm account is successfully enrolled in Prisma Cloud console
  4. delete the account from the Prisma Cloud console
  5. rerun terraform plan

Context

Terraform is designed as a declarative tool, meaning every time Terraform runs (successfully) it should result in the state of the managed environment matching what is defined in code. In this case, changes made outside of Terraform (i.e. deleting the cloud account via the Console) are not being detected as the resource having been deleted, but instead an error is being reported back through to the user. Seems as if this error should be caught and cause the prismacloud_cloud_account_v2 resource to consider itself deleted from the Prisma Cloud tenancy, and re-create (i.e. "taint").

Tangentially related (in the sense they describe a similar "we'll pass-thru an HTTP status code and give you the HTML content which is empty" error pattern):

Your Environment

erikpaasonen commented 11 months ago

confirmed that this issue still occurs with prismacloud provider v1.5.0. edited the OP to reflect.

AnushreeHS commented 5 months ago

@erikpaasonen Thanks for opening the issue, a fix has been released with terraform version = "1.5.5" Closing the issue Thanks