Skip to content

Commit

Permalink
New features and improvements (#437)
Browse files Browse the repository at this point in the history
* Add Atmos custom commands

* Update Go and packages versions

* Add Sprig functions support to Atmos vendoring Go templates

* Update `context` in imports

* Update `context` in imports

* Update `context` in imports

* Update `context` in imports

* Update `context` in imports

* Update `context` in imports

* Add global `terraform.command` and `helmfile.command` sections

* Update `atmos terraform clean` command

* Update Atmos help

* Update Atmos help

* Update Atmos help

* Update Atmos help

* Update Atmos help

* Add OCI support to `atmos vendor`

* Add OCI support to `atmos vendor` command

* Add OCI support to `atmos vendor` command

* Add OCI support to `atmos vendor` command

* Add OCI support to `atmos vendor` command

* Add OCI support to `atmos vendor` command

* Add OCI support to `atmos vendor` command

* Add OCI support to `atmos vendor` command

* Add OCI support to `atmos vendor` command

* Add OCI support to `atmos vendor` command

* Add OCI support to `atmos vendor` command

* Add OCI support to `atmos vendor` command

* Add OCI support to `atmos vendor` command

* Add OCI support to `atmos vendor` command

* Add examples of Rego policies for Atmos components and stacks validation

* Add examples of Rego policies for Atmos components and stacks validation

* Add examples of Rego policies for Atmos components and stacks validation

* Add examples of Rego policies for Atmos components and stacks validation

* Update internal/exec/oci_utils.go

Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <erik@cloudposse.com>

* updates

* Update website/docs/core-concepts/components/component-validation.md

Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <erik@cloudposse.com>

* updates

* updates

* updates

* updates

* updates

---------

Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <erik@cloudposse.com>
  • Loading branch information
aknysh and osterman committed Oct 14, 2023
1 parent a0b90d7 commit 5fa72c9
Show file tree
Hide file tree
Showing 27 changed files with 1,322 additions and 262 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: 'Setup Go'
uses: actions/setup-go@v3
with:
go-version: '1.20'
go-version: '1.21'

# Print Go version
- run: go version
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "1.20"
go-version: "1.21"
id: go

- name: Check out code into the Go module directory
Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "1.20"
go-version: "1.21"
id: go

- name: Check out code into the Go module directory
Expand Down
8 changes: 4 additions & 4 deletions cmd/cmd_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func executeCustomCommand(
// process the component stack config and expose it in {{ .ComponentConfig.xxx.yyy.zzz }} Go template variables
if commandConfig.ComponentConfig.Component != "" && commandConfig.ComponentConfig.Stack != "" {
// Process Go templates in the command's 'component_config.component'
component, err := u.ProcessTmpl(fmt.Sprintf("component-config-component-%d", i), commandConfig.ComponentConfig.Component, data)
component, err := u.ProcessTmpl(fmt.Sprintf("component-config-component-%d", i), commandConfig.ComponentConfig.Component, data, false)
if err != nil {
u.LogErrorAndExit(err)
}
Expand All @@ -179,7 +179,7 @@ func executeCustomCommand(
}

// Process Go templates in the command's 'component_config.stack'
stack, err := u.ProcessTmpl(fmt.Sprintf("component-config-stack-%d", i), commandConfig.ComponentConfig.Stack, data)
stack, err := u.ProcessTmpl(fmt.Sprintf("component-config-stack-%d", i), commandConfig.ComponentConfig.Stack, data, false)
if err != nil {
u.LogErrorAndExit(err)
}
Expand Down Expand Up @@ -221,7 +221,7 @@ func executeCustomCommand(
value = strings.TrimRight(res, "\r\n")
} else {
// Process Go templates in the values of the command's ENV vars
value, err = u.ProcessTmpl(fmt.Sprintf("env-var-%d", i), value, data)
value, err = u.ProcessTmpl(fmt.Sprintf("env-var-%d", i), value, data, false)
if err != nil {
u.LogErrorAndExit(err)
}
Expand All @@ -243,7 +243,7 @@ func executeCustomCommand(

// Process Go templates in the command's steps.
// Steps support Go templates and have access to {{ .ComponentConfig.xxx.yyy.zzz }} Go template variables
commandToRun, err := u.ProcessTmpl(fmt.Sprintf("step-%d", i), step, data)
commandToRun, err := u.ProcessTmpl(fmt.Sprintf("step-%d", i), step, data, false)
if err != nil {
u.LogErrorAndExit(err)
}
Expand Down
8 changes: 4 additions & 4 deletions examples/complete/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Geodesic: https://github.com/cloudposse/geodesic/
ARG GEODESIC_VERSION=2.2.4
ARG GEODESIC_VERSION=2.6.0
ARG GEODESIC_OS=debian

# atmos: https://github.com/cloudposse/atmos
ARG ATMOS_VERSION=1.45.0
ARG ATMOS_VERSION=1.46.0

# Terraform: https://github.com/hashicorp/terraform/releases
ARG TF_VERSION=1.5.6
ARG TF_VERSION=1.6.1

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

# Geodesic message of the Day
# Geodesic message of the day
ENV MOTD_URL="https://geodesic.sh/motd"

# Geodesic banner message
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ spec:
# In 'uri', Golang templates are supported https://pkg.go.dev/text/template
# If 'version' is provided, '{{.Version}}' will be replaced with the 'version' value before pulling the files from 'uri'
uri: github.com/cloudposse/terraform-aws-components.git//modules/account-map?ref={{.Version}}
version: 1.240.0
version: 1.315.1
# Only include the files that match the 'included_paths' patterns
# If 'included_paths' is not specified, all files will be matched except those that match the patterns from 'excluded_paths'
# 'included_paths' support POSIX-style Globs for file names/paths (double-star `**` is supported)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# > atmos vendor pull -c infra/vpc-flow-logs-bucket
# Pulling sources for the component 'infra/vpc-flow-logs-bucket' from 'github.com/cloudposse/terraform-aws-components.git//modules/vpc-flow-logs-bucket?ref=0.194.0'
# and writing to 'examples/complete/components/terraform/infra/vpc-flow-logs-bucket'
# into 'examples/complete/components/terraform/infra/vpc-flow-logs-bucket'
#
# Including the file 'README.md' since it matches the '**/*.md' pattern from 'included_paths'
# Excluding the file 'context.tf' since it matches the '**/context.tf' pattern from 'excluded_paths'
Expand All @@ -17,9 +17,9 @@
# Including the file 'versions.tf' since it matches the '**/*.tf' pattern from 'included_paths'
#
# Pulling the mixin 'https://raw.githubusercontent.com/cloudposse/terraform-null-label/0.25.0/exports/context.tf'
# for the component 'infra/vpc-flow-logs-bucket' and writing to 'examples/complete/components/terraform/infra/vpc-flow-logs-bucket'
# for the component 'infra/vpc-flow-logs-bucket' into 'examples/complete/components/terraform/infra/vpc-flow-logs-bucket'
# Pulling the mixin 'https://raw.githubusercontent.com/cloudposse/terraform-aws-components/0.194.0/modules/datadog-agent/introspection.mixin.tf'
# for the component 'infra/vpc-flow-logs-bucket' and writing to 'examples/complete/components/terraform/infra/vpc-flow-logs-bucket'
# for the component 'infra/vpc-flow-logs-bucket' into 'examples/complete/components/terraform/infra/vpc-flow-logs-bucket'

apiVersion: atmos/v1
kind: ComponentVendorConfig
Expand All @@ -33,7 +33,7 @@ spec:
# In 'uri', Golang templates are supported https://pkg.go.dev/text/template
# If 'version' is provided, '{{.Version}}' will be replaced with the 'version' value before pulling the files from 'uri'
uri: github.com/cloudposse/terraform-aws-components.git//modules/vpc-flow-logs-bucket?ref={{.Version}}
version: 1.240.0
version: 1.315.1
# Only include the files that match the 'included_paths' patterns
# If 'included_paths' is not specified, all files will be matched except those that match the patterns from 'excluded_paths'
# 'included_paths' support POSIX-style Globs for file names/paths (double-star `**` is supported)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spec:
# In 'uri', Golang templates are supported https://pkg.go.dev/text/template
# If 'version' is provided, '{{.Version}}' will be replaced with the 'version' value before pulling the files from 'uri'
uri: github.com/cloudposse/terraform-aws-components.git//modules/vpc?ref={{.Version}}
version: 1.240.0
version: 1.315.1
# Only include the files that match the 'included_paths' patterns
# If 'included_paths' is not specified, all files will be matched except those that match the patterns from 'excluded_paths'
# 'included_paths' support POSIX-style Globs for file names/paths (double-star `**` is supported)
Expand Down
26 changes: 26 additions & 0 deletions examples/complete/components/terraform/infra/vpc2/component.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# This is an example of how to download a Terraform component from an OCI registry (https://opencontainers.org), e.g. AWS Public ECR

# 'component.yaml' in the component folder is processed by the 'atmos' commands
# 'atmos vendor pull -c infra/vpc2' or 'atmos vendor pull --component infra/vpc2'

apiVersion: atmos/v1
kind: ComponentVendorConfig
metadata:
name: stable/aws/vpc
description: Config for vendoring of 'stable/aws/vpc' component
spec:
source:
# Source 'uri' supports the following protocols: OCI (https://opencontainers.org), Git, Mercurial, HTTP, HTTPS, Amazon S3, Google GCP,
# and all URL and archive formats as described in https://github.com/hashicorp/go-getter
# In 'uri', Golang templates are supported https://pkg.go.dev/text/template
# If 'version' is provided, '{{.Version}}' will be replaced with the 'version' value before pulling the files from 'uri'
# Download the component from the AWS public ECR registry (https://docs.aws.amazon.com/AmazonECR/latest/public/public-registries.html)
uri: "oci://public.ecr.aws/cloudposse/components/terraform/stable/aws/vpc:{{.Version}}"
version: "latest"
# Only include the files that match the 'included_paths' patterns
# If 'included_paths' is not specified, all files will be matched except those that match the patterns from 'excluded_paths'
# 'included_paths' support POSIX-style Globs for file names/paths (double-star `**` is supported)
# https://en.wikipedia.org/wiki/Glob_(programming)
# https://github.com/bmatcuk/doublestar#patterns
included_paths:
- "**/*.*"

0 comments on commit 5fa72c9

Please sign in to comment.