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

fix(product_enablement): avoid unexpected diff #689

Merged
merged 4 commits into from
May 2, 2023

Conversation

Integralist
Copy link
Collaborator

@Integralist Integralist commented Apr 29, 2023

A specific logic flow scenario in the TF provider is causing the product_enablement block to be displayed to customers as a resource that is going to be deleted (as part of their plan’s diff output) which is confusing as most customers are not expecting to see it and have no idea what the product_enablement block is.

The reason this happens is because the TF provider has logic to handle fixing drift in service versions (e.g. a user makes changes outside of Terraform). If, for example, a customer clones their service version outside of Terraform and activates a change separate from the TF provider, then this will cause the TF provider to call all Fastly APIs to see what has changed.

This consequently means the Product Enablement API is called and the local TF state is updated to include a product_block and thus a diff that shows the same block being deleted (because the user doesn’t have that block defined in their TF config file) is displayed as part of the plan’s diff output.

To avoid this we only call the Fastly API for Product Enablement during the TF provider's READ operation if this block already exists within the user's local state (i.e. they've successfully applied a plan with product_enablement explicitly defined in their Terraform configuration file) OR if it exists in their state PLUS an import or resync of data is required.

@Integralist Integralist merged commit 2003461 into main May 2, 2023
@Integralist Integralist deleted the integralist/pe-diff-avoid branch May 2, 2023 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant