Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
aknysh committed Jun 20, 2024
1 parent 0703d13 commit 6746ba4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
15 changes: 8 additions & 7 deletions internal/exec/describe_stacks.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ func ExecuteDescribeStacks(
finalStacksMap[stackName] = make(map[string]any)
}

configAndStacksInfo.Stack = stackName
configAndStacksInfo.ComponentSection["atmos_component"] = componentName
configAndStacksInfo.ComponentSection["atmos_stack"] = stackName
configAndStacksInfo.ComponentSection["stack"] = stackName
Expand All @@ -252,6 +253,13 @@ func ExecuteDescribeStacks(
finalStacksMap[stackName].(map[string]any)["components"].(map[string]any)["terraform"].(map[string]any)[componentName] = make(map[string]any)
}

// Atmos component, stack, and stack manifest file
componentSection["atmos_component"] = componentName
componentSection["atmos_stack"] = stackName
componentSection["stack"] = stackName
componentSection["atmos_stack_file"] = stackFileName
componentSection["atmos_manifest"] = stackFileName

// Terraform workspace
workspace, err := BuildTerraformWorkspace(cliConfig, configAndStacksInfo)
if err != nil {
Expand All @@ -260,13 +268,6 @@ func ExecuteDescribeStacks(
componentSection["workspace"] = workspace
configAndStacksInfo.ComponentSection["workspace"] = workspace

// Atmos component, stack, and stack manifest file
componentSection["atmos_component"] = componentName
componentSection["atmos_stack"] = stackName
componentSection["stack"] = stackName
componentSection["atmos_stack_file"] = stackFileName
componentSection["atmos_manifest"] = stackFileName

// Process `Go` templates
componentSectionStr, err := u.ConvertToYAML(componentSection)
if err != nil {
Expand Down
21 changes: 19 additions & 2 deletions internal/exec/terraform_generate_varfiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ package exec
import (
"errors"
"fmt"
c "github.com/cloudposse/atmos/pkg/convert"
"github.com/mitchellh/mapstructure"
"path"
"path/filepath"
"strings"

"github.com/mitchellh/mapstructure"
"github.com/spf13/cobra"

cfg "github.com/cloudposse/atmos/pkg/config"
c "github.com/cloudposse/atmos/pkg/convert"
"github.com/cloudposse/atmos/pkg/schema"
u "github.com/cloudposse/atmos/pkg/utils"
)
Expand Down Expand Up @@ -212,12 +212,29 @@ func ExecuteTerraformGenerateVarfiles(
}
}

configAndStacksInfo.Context = context
configAndStacksInfo.Stack = stackName
configAndStacksInfo.ComponentSection["atmos_component"] = componentName
configAndStacksInfo.ComponentSection["atmos_stack"] = stackName
configAndStacksInfo.ComponentSection["stack"] = stackName
configAndStacksInfo.ComponentSection["atmos_stack_file"] = stackFileName
configAndStacksInfo.ComponentSection["atmos_manifest"] = stackFileName

// Terraform workspace
workspace, err := BuildTerraformWorkspace(cliConfig, configAndStacksInfo)
if err != nil {
return err
}
componentSection["workspace"] = workspace
configAndStacksInfo.ComponentSection["workspace"] = workspace

// Atmos component, stack, and stack manifest file
componentSection["atmos_component"] = componentName
componentSection["atmos_stack"] = stackName
componentSection["stack"] = stackName
componentSection["atmos_stack_file"] = stackFileName
componentSection["atmos_manifest"] = stackFileName

// Process `Go` templates
componentSectionStr, err := u.ConvertToYAML(componentSection)
if err != nil {
Expand Down

0 comments on commit 6746ba4

Please sign in to comment.