Skip to content

Commit

Permalink
Update internal/features/stacks/state/stack_meta.go
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Banck <[email protected]>
  • Loading branch information
jpogran and dbanck authored Jul 16, 2024
1 parent 184b3bc commit eae4215
Showing 1 changed file with 29 additions and 5 deletions.
34 changes: 29 additions & 5 deletions internal/features/stacks/state/stack_meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,35 @@ type StackMetadata struct {

func (sm StackMetadata) Copy() StackMetadata {
newSm := StackMetadata{
Filenames: sm.Filenames,
Components: sm.Components,
Variables: sm.Variables,
Outputs: sm.Outputs,
ProviderRequirements: sm.ProviderRequirements,
Filenames: sm.Filenames,
}

if sm.Components != nil {
newSm.Components = make(map[string]tfstack.Component, len(sm.Components))
for k, v := range sm.Components {
newSm.Components[k] = v
}
}

if sm.Variables != nil {
newSm.Variables = make(map[string]tfstack.Variable, len(sm.Variables))
for k, v := range sm.Variables {
newSm.Variables[k] = v
}
}

if sm.Outputs != nil {
newSm.Outputs = make(map[string]tfstack.Output, len(sm.Outputs))
for k, v := range sm.Outputs {
newSm.Outputs[k] = v
}
}

if sm.ProviderRequirements != nil {
newSm.ProviderRequirements = make(map[string]tfstack.ProviderRequirement, len(sm.ProviderRequirements))
for k, v := range sm.ProviderRequirements {
newSm.ProviderRequirements[k] = v
}
}

return newSm
Expand Down

0 comments on commit eae4215

Please sign in to comment.