Skip to content

Commit

Permalink
Update spacelift module and example (#42)
Browse files Browse the repository at this point in the history
* Update `spacelift` module

* Update `spacelift` module
  • Loading branch information
aknysh authored Nov 8, 2021
1 parent 5150181 commit a82a2fa
Show file tree
Hide file tree
Showing 52 changed files with 453 additions and 773 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -346,13 +346,13 @@ Available targets:
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.0 |
| <a name="requirement_external"></a> [external](#requirement\_external) | >= 2.0 |
| <a name="requirement_local"></a> [local](#requirement\_local) | >= 1.3 |
| <a name="requirement_utils"></a> [utils](#requirement\_utils) | >= 0.17.0 |
| <a name="requirement_utils"></a> [utils](#requirement\_utils) | >= 0.17.4 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_utils"></a> [utils](#provider\_utils) | >= 0.17.0 |
| <a name="provider_utils"></a> [utils](#provider\_utils) | >= 0.17.4 |

## Modules

Expand Down
4 changes: 2 additions & 2 deletions docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.0 |
| <a name="requirement_external"></a> [external](#requirement\_external) | >= 2.0 |
| <a name="requirement_local"></a> [local](#requirement\_local) | >= 1.3 |
| <a name="requirement_utils"></a> [utils](#requirement\_utils) | >= 0.17.0 |
| <a name="requirement_utils"></a> [utils](#requirement\_utils) | >= 0.17.4 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_utils"></a> [utils](#provider\_utils) | >= 0.17.0 |
| <a name="provider_utils"></a> [utils](#provider\_utils) | >= 0.17.4 |

## Modules

Expand Down
2 changes: 1 addition & 1 deletion examples/complete/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ terraform {
}
utils = {
source = "cloudposse/utils"
version = ">= 0.17.0"
version = ">= 0.17.4"
}
}
}
2 changes: 1 addition & 1 deletion examples/remote-state/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ terraform {
}
utils = {
source = "cloudposse/utils"
version = ">= 0.17.0"
version = ">= 0.17.4"
}
}
}
50 changes: 50 additions & 0 deletions examples/spacelift/atmos.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# CLI config is loaded from the following locations (from lowest to highest priority):
# system dir (`/usr/local/etc/atmos` on Linux, `%LOCALAPPDATA%/atmos` on Windows)
# home dir (~/.atmos)
# current directory
# ENV vars
# Command-line arguments
#
# It supports POSIX-style Globs for file names/paths (double-star `**` is supported)
# https://en.wikipedia.org/wiki/Glob_(programming)

components:
terraform:
# Can also be set using `ATMOS_COMPONENTS_TERRAFORM_BASE_PATH` ENV var, or `--terraform-dir` command-line argument
# Supports both absolute and relative paths
base_path: "./components/terraform"
# Can also be set using `ATMOS_COMPONENTS_TERRAFORM_APPLY_AUTO_APPROVE` ENV var
apply_auto_approve: false
# Can also be set using `ATMOS_COMPONENTS_TERRAFORM_DEPLOY_RUN_INIT` ENV var, or `--deploy-run-init` command-line argument
deploy_run_init: true
# Can also be set using `ATMOS_COMPONENTS_TERRAFORM_AUTO_GENERATE_BACKEND_FILE` ENV var, or `--auto-generate-backend-file` command-line argument
auto_generate_backend_file: false
helmfile:
# Can also be set using `ATMOS_COMPONENTS_HELMFILE_BASE_PATH` ENV var, or `--helmfile-dir` command-line argument
# Supports both absolute and relative paths
base_path: "./components/helmfile"
# Can also be set using `ATMOS_COMPONENTS_HELMFILE_KUBECONFIG_PATH` ENV var
kubeconfig_path: "/dev/shm"
# Can also be set using `ATMOS_COMPONENTS_HELMFILE_HELM_AWS_PROFILE_PATTERN` ENV var
helm_aws_profile_pattern: "{namespace}-{tenant}-gbl-{stage}-helm"
# Can also be set using `ATMOS_COMPONENTS_HELMFILE_CLUSTER_NAME_PATTERN` ENV var
cluster_name_pattern: "{namespace}-{tenant}-{environment}-{stage}-eks-cluster"

stacks:
# Can also be set using `ATMOS_STACKS_BASE_PATH` ENV var, or `--config-dir` and `--stacks-dir` command-line arguments
# Supports both absolute and relative paths
base_path: "./stacks"
# Can also be set using `ATMOS_STACKS_INCLUDED_PATHS` ENV var (comma-separated values string)
included_paths:
- "**/*"
# Can also be set using `ATMOS_STACKS_EXCLUDED_PATHS` ENV var (comma-separated values string)
excluded_paths:
- "globals/**/*"
- "catalog/**/*"
- "**/*globals*"
# Can also be set using `ATMOS_STACKS_NAME_PATTERN` ENV var
name_pattern: "{tenant}-{environment}-{stage}"

logs:
verbose: false
colors: true
9 changes: 1 addition & 8 deletions examples/spacelift/fixtures.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@ enabled = true

stack_config_path_template = "stacks/%s.yaml"

stacks = [
"uw2-dev",
"uw2-prod",
"uw2-staging",
"uw2-uat"
]

stack_deps_processing_enabled = false
stack_deps_processing_enabled = true

component_deps_processing_enabled = true

Expand Down
2 changes: 0 additions & 2 deletions examples/spacelift/main.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
module "spacelift" {
source = "../../modules/spacelift"

stacks = var.stacks
stack_config_path_template = var.stack_config_path_template
stack_config_path = "${path.cwd}/stacks"
stack_deps_processing_enabled = var.stack_deps_processing_enabled
component_deps_processing_enabled = var.component_deps_processing_enabled
imports_processing_enabled = var.imports_processing_enabled
Expand Down
5 changes: 5 additions & 0 deletions examples/spacelift/stacks/catalog/helmfile/echo-server.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
components:
helmfile:
echo-server:
vars:
installed: true
5 changes: 5 additions & 0 deletions examples/spacelift/stacks/catalog/helmfile/infra-server.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
components:
helmfile:
"infra/infra-server":
vars:
installed: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
components:
terraform:
"test/test-component-override":
vars:
service_1_name: "service-1-override"
service_1_map:
a: 1
b: 2
c: 3
service_1_list:
- 1
- 2
- 3
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
components:
terraform:
"test/test-component":
vars:
service_1_name: "service-1"
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
components:
terraform:
"test/test-component-override":
vars:
service_2_name: "service-2-override"
service_2_map:
a: 1
b: 2
c: 3
service_2_list:
- 1
- 2
- 3
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
components:
terraform:
"test/test-component":
vars:
service_2_name: "service-2"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
components:
terraform:
top-level-component1:
vars:
service_1_name: "top-level-service-1"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
components:
terraform:
top-level-component1:
vars:
service_2_name: "top-level-service-2"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
components:
terraform:
"test/test-component-override":
vars:
service_1_name: "service-1-override-2"
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# `import` supports POSIX-style Globs for file names/paths (double-star `**` is supported)
# https://en.wikipedia.org/wiki/Glob_(programming)
# https://pkg.go.dev/gopkg.in/godo.v2/glob
# https://github.com/bmatcuk/doublestar
# File extensions are optional (if not specified, `.yaml` is used by default)
import:
- catalog/terraform/services/service-?-override.*

components:
terraform:
"test/test-component-override":
# Specify terraform binary to run
command: "/usr/local/bin/terraform"
# By using `component` attribute, `test-component-override` inherits from `test-component` and can override its variables
# In this example, variables for each service are overridden in `catalog/services/service-?-override.*`
component: "test/test-component"
# Other variables can be overridden here
vars: {}
# Override remote state backend for this component
remote_state_backend_type: static # s3, remote, vault, static, etc.
remote_state_backend:
static:
val1: true
val2: "2"
val3: 3
val4: null
22 changes: 22 additions & 0 deletions examples/spacelift/stacks/catalog/terraform/test-component.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# `import` supports POSIX-style Globs for file names/paths (double-star `**` is supported)
# https://en.wikipedia.org/wiki/Glob_(programming)
# https://pkg.go.dev/gopkg.in/godo.v2/glob
# https://github.com/bmatcuk/doublestar
# File extensions are optional (if not specified, `.yaml` is used by default)
import:
- catalog/terraform/services/service-?.*

components:
terraform:
"test/test-component":
backend:
s3:
workspace_key_prefix: test-test-component
remote_state_backend:
s3:
workspace_key_prefix: test-test-component
settings:
spacelift:
workspace_enabled: true
vars:
enabled: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# `import` supports POSIX-style Globs for file names/paths (double-star `**` is supported)
# https://en.wikipedia.org/wiki/Glob_(programming)
# https://pkg.go.dev/gopkg.in/godo.v2/glob
# https://github.com/bmatcuk/doublestar
# File extensions are optional (if not specified, `.yaml` is used by default)
import:
- catalog/terraform/services/top-level-service-?.*

components:
terraform:
top-level-component1:
backend:
s3:
workspace_key_prefix: top-level-component1
remote_state_backend:
s3:
workspace_key_prefix: top-level-component1
settings:
spacelift:
workspace_enabled: true
vars:
enabled: true
19 changes: 19 additions & 0 deletions examples/spacelift/stacks/catalog/terraform/vpc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
components:
terraform:
"infra/vpc":
backend:
s3:
workspace_key_prefix: infra-vpc
remote_state_backend:
s3:
workspace_key_prefix: infra-vpc
settings:
spacelift:
workspace_enabled: true
vars:
enabled: true
name: "common"
subnet_type_tag_key: eg.io/subnet/type
nat_gateway_enabled: true
nat_instance_enabled: false
max_subnet_count: 3
53 changes: 0 additions & 53 deletions examples/spacelift/stacks/eks/eks-defaults.yaml

This file was deleted.

Loading

0 comments on commit a82a2fa

Please sign in to comment.