Skip to content

Commit

Permalink
Fix an issue with the component_info output from the `atmos describ…
Browse files Browse the repository at this point in the history
…e component` command. Add `assume_role` property to Atmos JSON Schema S3 backend (#621)

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates
  • Loading branch information
aknysh authored Jun 8, 2024
1 parent 4ea538d commit f466925
Show file tree
Hide file tree
Showing 15 changed files with 362 additions and 238 deletions.
2 changes: 1 addition & 1 deletion cmd/helmfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var helmfileCmd = &cobra.Command{
Use: "helmfile",
Aliases: []string{"hf"},
Short: "Execute 'helmfile' commands",
Long: `This command runs helmfile commands`,
Long: `This command runs Helmfile commands`,
FParseErrWhitelist: struct{ UnknownFlags bool }{UnknownFlags: true},
Run: func(cmd *cobra.Command, args []string) {
// Check Atmos configuration
Expand Down
4 changes: 2 additions & 2 deletions cmd/terraform.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
var terraformCmd = &cobra.Command{
Use: "terraform",
Aliases: []string{"tf"},
Short: "Execute 'terraform' commands",
Long: `This command executes 'terraform'' commands`,
Short: "Execute Terraform commands",
Long: `This command executes Terraform commands`,
FParseErrWhitelist: struct{ UnknownFlags bool }{UnknownFlags: true},
Run: func(cmd *cobra.Command, args []string) {
// Check Atmos configuration
Expand Down
4 changes: 2 additions & 2 deletions examples/quick-start/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ ARG GEODESIC_OS=debian
# https://atmos.tools/
# https://github.com/cloudposse/atmos
# https://github.com/cloudposse/atmos/releases
ARG ATMOS_VERSION=1.78.0
ARG ATMOS_VERSION=1.79.0

# Terraform: https://github.com/hashicorp/terraform/releases
ARG TF_VERSION=1.8.4
ARG TF_VERSION=1.8.5

FROM cloudposse/geodesic:${GEODESIC_VERSION}-${GEODESIC_OS}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,69 @@
"region": {
"type": "string"
},
"assume_role": {
"type": "object",
"additionalProperties": false,
"properties": {
"role_arn": {
"type": [
"string",
"null"
]
},
"duration": {
"type": [
"string",
"null"
]
},
"external_id": {
"type": [
"string",
"null"
]
},
"policy": {
"type": [
"string",
"null"
]
},
"policy_arns": {
"type": "array",
"uniqueItems": true,
"items": {
"type": "string"
}
},
"session_name": {
"type": [
"string",
"null"
]
},
"source_identity": {
"type": [
"string",
"null"
]
},
"tags": {
"type": [
"object",
"null"
],
"additionalProperties": true
},
"transitive_tag_keys": {
"type": "array",
"uniqueItems": true,
"items": {
"type": "string"
}
}
}
},
"role_arn": {
"type": [
"string",
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ require (
github.com/hashicorp/go-getter v1.7.4
github.com/hashicorp/hcl v1.0.0
github.com/hashicorp/hcl/v2 v2.20.1
github.com/hashicorp/terraform-config-inspect v0.0.0-20240509232506-4708120f8f30
github.com/hashicorp/terraform-config-inspect v0.0.0-20240607080351-271db412dbcb
github.com/ivanpirog/coloredcobra v1.0.1
github.com/json-iterator/go v1.1.12
github.com/jwalton/go-supportscolor v1.2.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -797,8 +797,8 @@ github.com/hashicorp/memberlist v0.5.0 h1:EtYPN8DpAURiapus508I4n9CzHs2W+8NZGbmmR
github.com/hashicorp/memberlist v0.5.0/go.mod h1:yvyXLpo0QaGE59Y7hDTsTzDD25JYBZ4mHgHUZ8lrOI0=
github.com/hashicorp/serf v0.10.1 h1:Z1H2J60yRKvfDYAOZLd2MU0ND4AH/WDz7xYHDWQsIPY=
github.com/hashicorp/serf v0.10.1/go.mod h1:yL2t6BqATOLGc5HF7qbFkTfXoPIY0WZdWHfEvMqbG+4=
github.com/hashicorp/terraform-config-inspect v0.0.0-20240509232506-4708120f8f30 h1:0qwr2oZy9mIIJMWh7W9NTHLWGMbEF5KEQ+QqM9hym34=
github.com/hashicorp/terraform-config-inspect v0.0.0-20240509232506-4708120f8f30/go.mod h1:Gz/z9Hbn+4KSp8A2FBtNszfLSdT2Tn/uAKGuVqqWmDI=
github.com/hashicorp/terraform-config-inspect v0.0.0-20240607080351-271db412dbcb h1:6gCfY5aQdQgRr0G5VDjnV5ENpd+hTamWaZfVz+lJ724=
github.com/hashicorp/terraform-config-inspect v0.0.0-20240607080351-271db412dbcb/go.mod h1:Gz/z9Hbn+4KSp8A2FBtNszfLSdT2Tn/uAKGuVqqWmDI=
github.com/hashicorp/vault/api v1.6.0 h1:B8UUYod1y1OoiGHq9GtpiqSnGOUEWHaA26AY8RQEDY4=
github.com/hashicorp/vault/api v1.6.0/go.mod h1:h1K70EO2DgnBaTz5IsL6D5ERsNt5Pce93ueVS2+t0Xc=
github.com/hashicorp/vault/sdk v0.5.0 h1:EED7p0OCU3OY5SAqJwSANofY1YKMytm+jDHDQ2EzGVQ=
Expand Down
35 changes: 15 additions & 20 deletions internal/exec/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,21 +441,6 @@ func ProcessStacks(
configAndStacksInfo.ComponentSection[cfg.ComponentSectionName] = configAndStacksInfo.ComponentFromArg
}

// Add component info, including Terraform config
componentInfo := map[string]any{}
componentInfo["component_type"] = configAndStacksInfo.ComponentType

if configAndStacksInfo.ComponentType == "terraform" {
componentPath := constructTerraformComponentWorkingDir(cliConfig, configAndStacksInfo)
componentInfo["component_path"] = componentPath
terraformConfiguration, _ := tfconfig.LoadModule(componentPath)
componentInfo["terraform_config"] = terraformConfiguration
} else if configAndStacksInfo.ComponentType == "helmfile" {
componentInfo["component_path"] = constructHelmfileComponentWorkingDir(cliConfig, configAndStacksInfo)
}

configAndStacksInfo.ComponentSection["component_info"] = componentInfo

// `sources` (stack config files where the variables and other settings are defined)
sources, err := ProcessConfigSources(configAndStacksInfo, rawStackConfigs)
if err != nil {
Expand Down Expand Up @@ -569,11 +554,6 @@ func ProcessStacks(
configAndStacksInfo.ComponentSection["atlantis_project"] = atlantisProjectName
}

// Process `command`
//if len(configAndStacksInfo.Command) == 0 {
// configAndStacksInfo.Command = configAndStacksInfo.ComponentType
//}

// Process the ENV variables from the `env` section
configAndStacksInfo.ComponentEnvList = u.ConvertEnvVars(configAndStacksInfo.ComponentEnvSection)

Expand Down Expand Up @@ -616,6 +596,21 @@ func ProcessStacks(
configAndStacksInfo.FinalComponent = configAndStacksInfo.Component
}

// Add component info, including Terraform config
componentInfo := map[string]any{}
componentInfo["component_type"] = configAndStacksInfo.ComponentType

if configAndStacksInfo.ComponentType == "terraform" {
componentPath := constructTerraformComponentWorkingDir(cliConfig, configAndStacksInfo)
componentInfo["component_path"] = componentPath
terraformConfiguration, _ := tfconfig.LoadModule(componentPath)
componentInfo["terraform_config"] = terraformConfiguration
} else if configAndStacksInfo.ComponentType == "helmfile" {
componentInfo["component_path"] = constructHelmfileComponentWorkingDir(cliConfig, configAndStacksInfo)
}

configAndStacksInfo.ComponentSection["component_info"] = componentInfo

return configAndStacksInfo, nil
}

Expand Down
2 changes: 1 addition & 1 deletion website/docs/cli/_category_.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"label": "CLI",
"position": 4,
"collapsible": true,
"collapsed": true,
"collapsed": true
}
2 changes: 1 addition & 1 deletion website/docs/integrations/atlantis.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ on:
branches: [ main ]
env:
ATMOS_VERSION: 1.78.0
ATMOS_VERSION: 1.79.0
ATMOS_CLI_CONFIG_PATH: ./
jobs:
Expand Down
2 changes: 1 addition & 1 deletion website/docs/integrations/github-actions/setup-atmos.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ jobs:
uses: cloudposse/github-action-setup-atmos
with:
# Make sure to pin to the latest version of atmos
atmos_version: 1.78.0
atmos_version: 1.79.0
```
</File>
2 changes: 1 addition & 1 deletion website/docs/introduction/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ operational mastery and innovation faster, transforming their infrastructure man

## How does Atmos work?

At a high-level, Atmos is responsible for managing the configuration that gets passed to [Components](/reference/glossary/component) when they are instantiated.
At a high-level, Atmos is responsible for managing the configuration that gets passed to [Components](/terms/component) when they are instantiated.

To make this less abstract, we're going to focus on Terraform and how configuration gets passed to it.
The secret to scaling architectures with Terraform, is to decompose it into smaller root modules. We want to keep these root modules
Expand Down
2 changes: 1 addition & 1 deletion website/docs/reference/glossary/_category_.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"label": "Glossary",
"collapsible": true,
"collapsed": true,
"collapsed": true
}
Loading

0 comments on commit f466925

Please sign in to comment.