Skip to content
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

Terraform detects product description drift, but cannot resolve it #99

Open
dmacbride-ep opened this issue May 17, 2021 · 1 comment
Open
Labels
bug Something isn't working

Comments

@dmacbride-ep
Copy link
Collaborator

dmacbride-ep commented May 17, 2021

Description

If I manually update a product whose state is managed by terraform, if I later rerun terraform apply Terraform will detect the drift and offer to fix it. It will even say it's made the change. However, it doesn't actually make the change; the drift is not resolved.

Steps To Reproduce

  • create a product using terraform
  • log into CM and update the product's description
  • do not make any changes to the TF files and re-run terraform apply

Expected Results

Terraform detects the drift, offers to correct it, and corrects it.

Actual results

Terraform detects the drift and says it will correct it, but fails to actually correct it. After running terraform apply I see the following plan:

Terraform will perform the following actions:

  # epcc_product.espresso-cleaning-tablets-bec250uk will be updated in-place
  ~ resource "epcc_product" "espresso-cleaning-tablets-bec250uk" {
      - description    = "A description" -> null
        id             = "8c92c2d2-158e-492e-bbee-e5352ddd7576"
        name           = "Espresso Cleaning Tablets"
        # (6 unchanged attributes hidden)
    }

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

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

If you answer yes it tries to apply the change and gives a success message ...

epcc_product.espresso-cleaning-tablets-bec250uk: 
Modifications complete after 1s [id=8c92c2d2-158e-492e-bbee-e5352ddd7576]

Apply complete! Resources: 0 added, 1 changed, 0 destroyed.

... but nothing actually happens in EPCC. The product is not actually updated. Rerunning terraform apply detects the drift again - the scenario repeats.

@dmacbride-ep dmacbride-ep added the bug Something isn't working label May 18, 2021
@dmacbride-ep
Copy link
Collaborator Author

Enabling TF_LOG=JSON gives additional insight. Console output is attached here:
issue-99-debug.log

Sifting through, we see JSON payload for the update is insufficient to make the change we are expecting

jsonPayload: {\"data\":[{\"id\":\"df4771c5-b216-4994-a1fe-f5912c1da2ef\",\"type\":\"file\"}]}","@module":"provider.terraform-provider-epcc","@timestamp":"2021-05-19T10:32:18.559785-04:00","timestamp":"2021-05-19T10:32:18.559-0400"}
  • the id in the json df4771c5-b216-4994-a1fe-f5912c1da2ef is the ID or a file object, not the product whose description we want to update. The product ID is `146020eb-1cc1-4ed5-9080-c7e946c761c2' in this case.

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

1 participant