Skip to content

SDX VPX provisioning resource returning error if the resource in the state file is missing rather than re-deploying it #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ksashokumar opened this issue Jun 19, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@ksashokumar
Copy link

If a resource deployed using SDX VPX provisioning resource gets deleted in the SDX, the provider is not creating the resource again when we do terraform apply. It responds with the following error.

Plan: 0 to add, 1 to change, 0 to destroy.

│ Error: failed: 404 Not Found ({ "errorcode": 10011, "message": "Resource does not exist", "severity": "ERROR" })

│ with module.dut_provision_sdx2.citrixsdx_provision_vpx.dut,
│ on ../modules/dut_sdx/main.tf line 1, in resource "citrixsdx_provision_vpx" "dut":
│ 1: resource "citrixsdx_provision_vpx" "dut" {

Steps to reproduce:

  1. Provision a VM in the SDX using SDX provider.
  2. Delete the VM directly in the SDX GUI.
  3. Now re-run the terraform apply command.
  4. Typically, the resource should re deploy the VM as per in the state file but it is throwing the error, "Resource does not exists".
  5. The resource code returns the error when the resource doesn't exists rather than setting it to NULL.
@HS1542
Copy link

HS1542 commented Jun 22, 2023

I would say this is by design and exactly what you would expect.

If you provision something through terraform, then you need to de-provision it aswell, by running terraform destroy or removing/commenting out that resource in your configuration.
As long as your state file knowns that a resource should exist, it will fail when it is unable to check the running state of that resource.

If you manually delete something, then you need to remove that resource from the state file, for instance by running
terraform state rm <resource.name>

@sumanth-lingappa sumanth-lingappa added the bug Something isn't working label May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants