-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Add variables to all commands that load configuration #38276
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
Merged
Merged
Changes from 18 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
74c7661
command: Add vars to validate command
dbanck 568245f
command: Add vars to graph command
dbanck ec8a9b7
command: Add vars to modules command
dbanck 8345e1d
command: Add vars to providers command
dbanck 6f5bcd4
command: Add vars to pvoiders lock command
dbanck dc02f0f
command: Add vars to providers mirror command
dbanck 324c4d8
command: Add vars to providers schema command
dbanck 13e8ba3
command: Add vars to state mv command
dbanck ab67b59
command: Add vars to state pull command
dbanck fbb4c5c
command: Add vars to state push command
dbanck b3e863c
command: Add vars to state replace command
dbanck ae1380f
command: Add vars to state rm command
dbanck 757d8c2
command: Add vars to taint command
dbanck 657be30
command: Add vars to get command (and refactor it)
dbanck b4ecfc2
Improve ParseVariableValues signature with a helper
dbanck 0e55462
Add check for missing const variables
dbanck e3bd9d7
Still require const variables when AllowUnsetVariables is set
dbanck a3c4bb2
Allow commands to fetch backend variables
dbanck ec5df8b
Add changelog
dbanck c25adc4
Potentially fetch backend variables for most commands
dbanck File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| // Copyright IBM Corp. 2014, 2026 | ||
| // SPDX-License-Identifier: BUSL-1.1 | ||
|
|
||
| package backendrun | ||
|
|
||
| import ( | ||
| "context" | ||
|
|
||
| "github.com/hashicorp/terraform/internal/command/arguments" | ||
| "github.com/hashicorp/terraform/internal/tfdiags" | ||
| ) | ||
|
|
||
| // ConstVariableSupplier is an optional interface that backends can implement | ||
| // to supply variable values from their remote storage. This is used to fetch | ||
| // const variable values that are needed during early configuration loading | ||
| // (e.g., for module source resolution), before a full operation is started. | ||
| type ConstVariableSupplier interface { | ||
| // FetchVariables retrieves Terraform variable values stored in the | ||
| // backend for the given workspace. Only variables that are relevant to | ||
| // Terraform (as opposed to environment variables or other categories) | ||
| // should be returned. | ||
| FetchVariables(ctx context.Context, workspace string) (map[string]arguments.UnparsedVariableValue, tfdiags.Diagnostics) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to make sure to document this properly, could be confusing for people on the remote backend if their backend does not load the vars.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, good point. I'll look for a good place to document this