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

backend/local: Allow experiments when loading config from snapshot #35144

Merged
merged 1 commit into from
May 9, 2024

Conversation

apparentlymart
Copy link
Member

If a saved plan is being applied using a Terraform CLI/Core build that allows use of language experiments then that should be allowed when the configuration is being loaded from the snapshot saved in a plan file, in the same way as it would've been handled when preparing to generate that plan file.

The local backend doesn't get told directly whether it should allow experiments, and instead its operation comes with a pre-configured configuration loader that may have the experiment flag set internally.

When we load from snapshot we can't use the operation's own config loader because that loads from the real filesystem, and so we'll copy over the experiments-allowed flag from the operation's config loader to achieve consistency while still loading the configuration from the snapshot in the plan file.

Without this a plan successfully created with experiments would fail with confusing errors during apply, because the snapshot config loader would not accept the same experiments that the plan-time config loader did.


There are no updates to automated tests here because unfortunately we don't really have good ways to test for correct propagation of the experiments-allowed flag, but I've tested this manually as part of my work on #35078 (which was how I found the bug in the first place).

If a saved plan is being applied using a Terraform CLI/Core build that
allows use of language experiments then that should be allowed when the
configuration is being loaded from the snapshot saved in a plan file, in
the same way as it would've been handled when preparing to generate that
plan file.

The local backend doesn't get told directly whether it should allow
experiments, and instead its operation comes with a pre-configured
configuration loader that may have the experiment flag set internally.

When we load from snapshot we can't use the operation's own config loader
because that loads from the real filesystem, and so we'll copy over the
experiments-allowed flag from the operation's config loader to achieve
consistency while still loading the configuration from the snapshot in
the plan file.

Without this a plan successfully created with experiments would fail with
confusing errors during apply, because the snapshot config loader would
not accept the same experiments that the plan-time config loader did.
@apparentlymart apparentlymart merged commit 1df01fd into main May 9, 2024
10 checks passed
Copy link

github-actions bot commented May 9, 2024

Reminder for the merging maintainer: if this is a user-visible change, please update the changelog on the appropriate release branch.

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.

None yet

2 participants