Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Update how operations use backend config state in context of PSS#37248

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
SarahFrench wants to merge13 commits intomain
base:main
Choose a base branch
Loading
frompss/update-how-operations-use-backend-config-state
Draft
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
13 commits
Select commitHold shift + click to select a range
e5701a9
Implement `ForPlan` method on `StateStoreConfigState`, add `Planner` …
SarahFrenchJun 16, 2025
fd7182a
Rename `ForPlan` method to `Plan`
SarahFrenchJun 16, 2025
ee6e9da
Allow plan files to contain information about state stores
SarahFrenchJun 17, 2025
1bb87e8
Add code needed for representing a state store in the Plan struct, wh…
SarahFrenchJun 17, 2025
9e076d8
Add ability to read/write either a backend or state store's data in a…
SarahFrenchJun 17, 2025
44ce79b
Update plan's `ProviderAddrs` method to include the provider used for…
SarahFrenchJun 17, 2025
a2acc33
Split interfaces
SarahFrenchJun 17, 2025
5255d9d
Merge branch 'main' into pss/store-pss-in-planfile
SarahFrenchJun 18, 2025
2479cdc
WIP
SarahFrenchJun 17, 2025
5b825b2
WIP - allowing apply operation to use plan file content about backend…
SarahFrenchJun 17, 2025
19ede22
Fix - it is valid to not have a backend config in the plan file
SarahFrenchJun 18, 2025
571bffc
Update test following change to BackendForLocalPlan argument
SarahFrenchJun 18, 2025
a5a439f
Fix code consistency issue
SarahFrenchJun 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
WIP - allowing apply operation to use plan file content about backend…
…/state_store
  • Loading branch information
@SarahFrench
SarahFrench committedJun 18, 2025
commit5b825b2be47df1334802adc56ece54e7d3555264
6 changes: 3 additions & 3 deletionsinternal/command/apply.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -210,16 +210,16 @@ func (c *ApplyCommand) PrepareBackend(planFile *planfile.WrappedPlanFile, args *
))
return nil, diags
}
if plan.Backend.Config == nil {
if plan.Backend.Config == nil&& plan.StateStore.Config == nil{
// Should never happen; always indicates a bug in the creation of the plan file
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Failed to read plan from plan file",
"The given plan file does not have a valid backend configuration. This is a bug in the Terraform command that generated this plan file.",
"The given plan file does not haveeithera valid backend or state_store configuration. This is a bug in the Terraform command that generated this plan file.",
))
return nil, diags
}
be, beDiags = c.BackendForLocalPlan(plan.Backend)
be, beDiags = c.BackendForLocalPlan(plan)
} else {
// Both new plans and saved cloud plans load their backend from config.
backendConfig, configDiags := c.loadBackendConfig(".")
Expand Down
25 changes: 17 additions & 8 deletionsinternal/command/meta_backend.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -302,19 +302,28 @@ func (m *Meta) selectWorkspace(b backend.Backend) error {
// The current workspace name is also stored as part of the plan, and so this
// method will check that it matches the currently-selected workspace name
// and produce error diagnostics if not.
func (m *Meta) BackendForLocalPlan(settingsplans.Backend) (backendrun.OperationsBackend, tfdiags.Diagnostics) {
func (m *Meta) BackendForLocalPlan(plan *plans.Plan) (backendrun.OperationsBackend, tfdiags.Diagnostics) {
var diags tfdiags.Diagnostics

f := backendInit.Backend(settings.Type)
if f == nil {
diags = diags.Append(fmt.Errorf(strings.TrimSpace(errBackendSavedUnknown), settings.Type))
return nil, diags
var b backend.Backend
var config plans.DynamicValue
if plan.StateStore.Config != nil {
// TODO - code for state_store
} else if plan.Backend.Config != nil {
settings := plan.Backend
config = plan.Backend.Config

f := backendInit.Backend(settings.Type)
if f == nil {
diags = diags.Append(fmt.Errorf(strings.TrimSpace(errBackendSavedUnknown), settings.Type))
return nil, diags
}
b = f()
log.Printf("[TRACE] Meta.BackendForLocalPlan: instantiated backend of type %T", b)
}
b := f()
log.Printf("[TRACE] Meta.BackendForLocalPlan: instantiated backend of type %T", b)

schema := b.ConfigSchema()
configVal, err :=settings.Config.Decode(schema.ImpliedType())
configVal, err :=config.Decode(schema.ImpliedType())
if err != nil {
diags = diags.Append(fmt.Errorf("saved backend configuration is invalid: %w", err))
return nil, diags
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp