Skip to content

Commit

Permalink
Revert "updates"
Browse files Browse the repository at this point in the history
This reverts commit 85116e5.
  • Loading branch information
aknysh committed Dec 8, 2024
1 parent 3648d9b commit bd20472
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions internal/exec/stack_processor_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,33 @@ func ProcessYAMLConfigFile(
return nil, nil, nil, err
}

// Add the `overrides` section for all components in this manifest
if len(finalTerraformOverrides) > 0 || len(finalHelmfileOverrides) > 0 {
if componentsSection, ok := stackConfigMap["components"].(map[string]any); ok {
// Terraform
if len(finalTerraformOverrides) > 0 {
if terraformSection, ok := componentsSection["terraform"].(map[string]any); ok {
for _, compSection := range terraformSection {
if componentSection, ok := compSection.(map[string]any); ok {
componentSection["overrides"] = finalTerraformOverrides
}
}
}
}

// Helmfile
if len(finalHelmfileOverrides) > 0 {
if helmfileSection, ok := componentsSection["helmfile"].(map[string]any); ok {
for _, compSection := range helmfileSection {
if componentSection, ok := compSection.(map[string]any); ok {
componentSection["overrides"] = finalHelmfileOverrides
}
}
}
}
}
}

// Find and process all imports
importStructs, err := ProcessImportSection(stackConfigMap, relativeFilePath)
if err != nil {
Expand Down Expand Up @@ -457,33 +484,6 @@ func ProcessYAMLConfigFile(
}
}

// Add the `overrides` section for all components in this manifest
if len(finalTerraformOverrides) > 0 || len(finalHelmfileOverrides) > 0 {
if componentsSection, ok := stackConfigMap["components"].(map[string]any); ok {
// Terraform
if len(finalTerraformOverrides) > 0 {
if terraformSection, ok := componentsSection["terraform"].(map[string]any); ok {
for _, compSection := range terraformSection {
if componentSection, ok := compSection.(map[string]any); ok {
componentSection[cfg.OverridesSectionName] = finalTerraformOverrides
}
}
}
}

// Helmfile
if len(finalHelmfileOverrides) > 0 {
if helmfileSection, ok := componentsSection["helmfile"].(map[string]any); ok {
for _, compSection := range helmfileSection {
if componentSection, ok := compSection.(map[string]any); ok {
componentSection[cfg.OverridesSectionName] = finalHelmfileOverrides
}
}
}
}
}
}

if len(stackConfigMap) > 0 {
stackConfigs = append(stackConfigs, stackConfigMap)
}
Expand Down

0 comments on commit bd20472

Please sign in to comment.