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

Add TF_STATE_PERSIST_INTERVAL environment variable. #35176

Merged
merged 4 commits into from
May 17, 2024

Conversation

sebasslash
Copy link
Contributor

This PR stems from the initial work done by @alexott (#35116), which fixes #35115. These changes are a simple refactor to delegate handling this env var to command.Meta. This allows us to pass the user specified persist interval to backendrun.Operation and keep env var handling (with existing vars such as TF_WORKSPACE, TF_INPUT) centralized within command.Meta.

The default interval remains 20 seconds and serves as a global minimum interval. Remote backends such as cloud may override the default using the X-Terraform-Snapshot-Interval header. If the default interval value is greater than the user-specified value, the default will be used.

Target Release

1.9.x

Draft CHANGELOG entry

ENHANCEMENTS

  • Added TF_STATE_PERSIST_INTERVAL environment variable to control persist interval in the remote state backend.

Signed-off-by: Alex Ott <alexott@gmail.com>
@sebasslash
Copy link
Contributor Author

Still missing updating the docs and adding a few more tests, if possible.

Copy link
Contributor

@brandonc brandonc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thank you.

internal/command/meta.go Outdated Show resolved Hide resolved
Copy link
Contributor

@alexott alexott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you - just one comment about boundary check

internal/command/meta.go Show resolved Hide resolved
@sebasslash sebasslash force-pushed the sebasslash/tf-15302_modifiable-snapshot-interval branch from 2c03fea to 5a625a3 Compare May 17, 2024 18:16
@sebasslash sebasslash marked this pull request as ready for review May 17, 2024 18:17
Copy link
Contributor

@rkoron007 rkoron007 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a style suggestion, but feel free to push back if it doesn't feel good.

website/docs/cli/config/environment-variables.mdx Outdated Show resolved Hide resolved
@sebasslash sebasslash force-pushed the sebasslash/tf-15302_modifiable-snapshot-interval branch from 5a625a3 to b28c8bf Compare May 17, 2024 18:55
@sebasslash sebasslash merged commit 7012371 into main May 17, 2024
7 checks passed
Copy link

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.

Make persistence interval configurable for the remote state backend
5 participants