Skip to content

Commit

Permalink
Add Terraform Cloud backend. Add/update docs (#572)
Browse files Browse the repository at this point in the history
* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates
  • Loading branch information
aknysh authored Apr 2, 2024
1 parent 674d2d0 commit 93fddf0
Show file tree
Hide file tree
Showing 23 changed files with 1,137 additions and 142 deletions.
6 changes: 3 additions & 3 deletions examples/quick-start/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Geodesic: https://github.com/cloudposse/geodesic/
ARG GEODESIC_VERSION=2.9.4
ARG GEODESIC_VERSION=2.9.5
ARG GEODESIC_OS=debian

# Atmos
# https://atmos.tools/
# https://github.com/cloudposse/atmos
# https://github.com/cloudposse/atmos/releases
ARG ATMOS_VERSION=1.66.0
ARG ATMOS_VERSION=1.67.0

# Terraform: https://github.com/hashicorp/terraform/releases
ARG TF_VERSION=1.7.3
ARG TF_VERSION=1.7.5

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

Expand Down
37 changes: 24 additions & 13 deletions examples/quick-start/stacks/orgs/acme/_defaults.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
vars:
namespace: acme

# Terraform S3 backend configuration
#terraform:
# backend_type: s3
# backend:
# s3:
# acl: "bucket-owner-full-control"
# encrypt: true
# bucket: "your-s3-bucket-name"
# dynamodb_table: "your-dynamodb-table-name"
# key: "terraform.tfstate"
# region: "your-aws-region"
# role_arn: "arn:aws:iam::<your account ID>:role/<IAM Role with permissions to access the Terraform backend>"

terraform:
vars:
tags:
Expand All @@ -25,3 +12,27 @@ terraform:
# https://masterminds.github.io/sprig/date.html
# https://pkg.go.dev/time#pkg-constants
provisioned_at: '{{ dateInZone "2006-01-02T15:04:05Z07:00" (now) "UTC" }}'

# Terraform backend configuration
# https://atmos.tools/core-concepts/components/terraform-backends
# https://developer.hashicorp.com/terraform/language/settings/backends/configuration
# backend_type: cloud # s3, cloud
# backend:
# # AWS S3 backend
# s3:
# acl: "bucket-owner-full-control"
# encrypt: true
# bucket: "your-s3-bucket-name"
# dynamodb_table: "your-dynamodb-table-name"
# key: "terraform.tfstate"
# region: "us-east-2"
# role_arn: "arn:aws:iam::<your account ID>:role/<IAM Role with permissions to access the Terraform backend>"
# # Terraform Cloud backend
# # https://developer.hashicorp.com/terraform/cli/cloud/settings
# cloud:
# organization: "your-org"
# hostname: "app.terraform.io"
# workspaces:
# # The token `{terraform_workspace}` will be automatically replaced with the
# # Terraform workspace for each Atmos component
# name: "{terraform_workspace}"
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,8 @@
"vault",
"static",
"azurerm",
"gcs"
"gcs",
"cloud"
],
"description": "Backend type",
"title": "backend_type"
Expand All @@ -455,7 +456,9 @@
"remote",
"vault",
"static",
"azurerm"
"azurerm",
"gcs",
"cloud"
],
"description": "Remote state backend type",
"title": "remote_state_backend_type"
Expand Down Expand Up @@ -523,6 +526,14 @@
"azurerm": {
"type": "object",
"additionalProperties": true
},
"gcs": {
"type": "object",
"additionalProperties": true
},
"cloud": {
"type": "object",
"additionalProperties": true
}
},
"required": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ settings:
terraform:
vars: {}

backend_type: s3 # s3, remote, vault, etc.
backend_type: s3 # s3, remote, vault, static, azurerm, gcs, cloud
backend:
s3:
encrypt: true
Expand Down
10 changes: 9 additions & 1 deletion examples/tests/stacks/orgs/cp/_defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ terraform:
region: "{{ .vars.region }}"
terraform_workspace: "{{ .workspace }}"

backend_type: s3 # s3, remote, vault, static, azurerm, etc.
backend_type: s3 # s3, remote, vault, static, azurerm, gcs, cloud

# https://developer.hashicorp.com/terraform/language/settings/backends/configuration
backend:
s3:
encrypt: true
Expand All @@ -30,6 +32,12 @@ terraform:
key: dev.atmos
remote: {}
vault: {}
# https://developer.hashicorp.com/terraform/cli/cloud/settings
cloud:
organization: "my-org"
hostname: "app.terraform.io"
workspaces:
name: "{terraform_workspace}"

remote_state_backend:
s3:
Expand Down
30 changes: 15 additions & 15 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ require (
github.com/charmbracelet/lipgloss v0.10.0
github.com/elewis787/boa v0.1.2
github.com/fatih/color v1.16.0
github.com/go-git/go-git/v5 v5.11.0
github.com/google/go-containerregistry v0.19.0
github.com/go-git/go-git/v5 v5.12.0
github.com/google/go-containerregistry v0.19.1
github.com/google/go-github/v59 v59.0.0
github.com/google/uuid v1.6.0
github.com/hashicorp/go-getter v1.7.3
github.com/hashicorp/hcl v1.0.0
github.com/hashicorp/hcl/v2 v2.20.0
github.com/hashicorp/hcl/v2 v2.20.1
github.com/hashicorp/terraform-config-inspect v0.0.0-20231204233900-a34142ec2a72
github.com/imdario/mergo v0.3.13
github.com/ivanpirog/coloredcobra v1.0.1
Expand All @@ -27,7 +27,7 @@ require (
github.com/lrstanley/bubblezone v0.0.0-20240125042004-b7bafc493195
github.com/mitchellh/go-homedir v1.1.0
github.com/mitchellh/mapstructure v1.5.0
github.com/open-policy-agent/opa v0.62.1
github.com/open-policy-agent/opa v0.63.0
github.com/otiai10/copy v1.14.0
github.com/pkg/errors v0.9.1
github.com/samber/lo v1.39.0
Expand All @@ -36,7 +36,7 @@ require (
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.18.2
github.com/stretchr/testify v1.9.0
github.com/zclconf/go-cty v1.14.3
github.com/zclconf/go-cty v1.14.4
gopkg.in/yaml.v2 v2.4.0
mvdan.cc/sh/v3 v3.8.0
)
Expand All @@ -54,7 +54,7 @@ require (
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/Microsoft/hcsshim v0.11.4 // indirect
github.com/OneOfOne/xxhash v1.2.8 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230828082145-3c4c8a2d2371 // indirect
github.com/ProtonMail/go-crypto v1.0.0 // indirect
github.com/agext/levenshtein v1.2.2 // indirect
github.com/agnivade/levenshtein v1.1.1 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
Expand All @@ -69,15 +69,15 @@ require (
github.com/cloudflare/circl v1.3.7 // indirect
github.com/common-nighthawk/go-figure v0.0.0-20210622060536-734e95fb86be // indirect
github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 // indirect
github.com/containerd/containerd v1.7.13 // indirect
github.com/containerd/containerd v1.7.14 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/containerd/stargz-snapshotter/estargz v0.14.3 // indirect
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dlclark/regexp2 v1.4.0 // indirect
github.com/docker/cli v24.0.0+incompatible // indirect
github.com/docker/distribution v2.8.2+incompatible // indirect
github.com/docker/docker v25.0.3+incompatible // indirect
github.com/docker/cli v26.0.0+incompatible // indirect
github.com/docker/distribution v2.8.3+incompatible // indirect
github.com/docker/docker v26.0.0+incompatible // indirect
github.com/docker/docker-credential-helpers v0.7.0 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
Expand All @@ -89,7 +89,7 @@ require (
github.com/go-logr/stdr v1.2.2 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/s2a-go v0.1.7 // indirect
Expand Down Expand Up @@ -136,10 +136,10 @@ require (
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sahilm/fuzzy v0.1.1-0.20230530133925-c48e322e2a8f // indirect
github.com/sergi/go-diff v1.3.1 // indirect
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
github.com/shopspring/decimal v1.2.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/skeema/knownhosts v1.2.1 // indirect
github.com/skeema/knownhosts v1.2.2 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
Expand Down Expand Up @@ -176,8 +176,8 @@ require (
google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect
google.golang.org/grpc v1.62.0 // indirect
google.golang.org/protobuf v1.32.0 // indirect
google.golang.org/grpc v1.62.1 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
Loading

0 comments on commit 93fddf0

Please sign in to comment.