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

[datadog_synthetics_test] prevent overriding the local state element from the backend response #2460

Merged
merged 2 commits into from
Jul 5, 2024

Conversation

etnbrd
Copy link
Contributor

@etnbrd etnbrd commented Jun 25, 2024

The element field of a browser test step contains the element locator, which auto-heals on the backend side, and constantly changes independently from any changes on the terraform config. Because of that, terraform is constantly prompting about these changes, which are confusing since these changes are not initiated by the user.

In response to this, we disabled the diff on the element field, preventing terraform from updating the element at all: #854.
We also introduced force_element_update to allow users to force updating the element if desired.

However the initial implementation didn't prevent the state from being updated when applying the config with other changes. The undesired diff kept reappearing. Moreover, force_element_update will always update the online resource, giving a false sense that the resource was modified.

This PR now prevents terraform from overriding the browser_step.*.params.element field in the local state with the response from the backend at all.
If force_element_update is set to true, it'll still keep in state the value from the config to track changes in the config.

If force_element_update is not set or set to false, terraform will just ignore the element part from the backend entirely.
If force_element_update is set to true, terraform won't prompt for any changes of element from the backend, and will update the online resource at every apply.

@etnbrd etnbrd force-pushed the etnbrd/SYNTH-523/element-state-stability branch from 6bb731a to 50a8456 Compare June 25, 2024 17:26
@etnbrd etnbrd force-pushed the etnbrd/SYNTH-523/element-state-stability branch from 29ec3fa to 4a3bc51 Compare June 28, 2024 14:25
@etnbrd etnbrd force-pushed the etnbrd/SYNTH-523/element-state-stability branch from 4a3bc51 to 5fb5801 Compare July 5, 2024 16:55
@etnbrd etnbrd marked this pull request as ready for review July 5, 2024 17:03
@etnbrd etnbrd requested review from a team as code owners July 5, 2024 17:03
nkzou
nkzou previously approved these changes Jul 5, 2024
@nkzou nkzou merged commit 8508ce8 into master Jul 5, 2024
10 checks passed
@nkzou nkzou deleted the etnbrd/SYNTH-523/element-state-stability branch July 5, 2024 19:45
bharling pushed a commit to bharling/terraform-provider-datadog that referenced this pull request Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants