Bot releases are hidden (Show)
Published by aknysh about 2 years ago
1.3.0
as 1.4.1
while fixing some remote state issues in 1.4.0
Published by aknysh over 3 years ago
process_stack_deps
input var to the stack_config
data sourcefalse
by default)remote-state
does not)Published by aknysh over 3 years ago
Published by aknysh over 3 years ago
imports
to stack outputstacks
to each component outputimports
attribute shows all imported stacks for the current stack - can be used in CI/CD pipelines to determine stack dependenciesstacks
attribute shows all the stacks the component (and its base component, if present) is declared in - can be used in CI/CD pipelines (e.g. Spacelift) to determine all stacks that the component depends on,imports:
- eks/eks-defaults
- globals
- uw2-globals
terraform:
aurora-postgres:
backend:
acl: bucket-owner-full-control
bucket: eg-uw2-root-tfstate
dynamodb_table: eg-uw2-root-tfstate-lock
encrypt: true
key: terraform.tfstate
region: us-west-2
role_arn: arn:aws:iam::XXXXXXXXXXXX:role/eg-gbl-root-terraform
workspace_key_prefix: aurora-postgres
backend_type: s3
stacks:
- globals
- uw2-dev
- uw2-globals
- uw2-prod
- uw2-staging
- uw2-uat
env:
ENV_TEST_1: test1
ENV_TEST_2: test2
ENV_TEST_3: test3
ENV_TEST_4: test4
ENV_TEST_5: test5
ENV_TEST_6: test6
ENV_TEST_7: test7
settings:
spacelift:
autodeploy: false
workspace_enabled: false
version: 0
vars:
cluster_size: 1
environment: uw2
instance_type: db.r4.large
namespace: eg
region: us-west-2
stage: dev
aurora-postgres-2:
backend:
acl: bucket-owner-full-control
bucket: eg-uw2-root-tfstate
dynamodb_table: eg-uw2-root-tfstate-lock
encrypt: true
key: terraform.tfstate
region: us-west-2
role_arn: arn:aws:iam::XXXXXXXXXXXX:role/eg-gbl-root-terraform
workspace_key_prefix: aurora-postgres
backend_type: s3
component: aurora-postgres
stacks:
- globals
- uw2-dev
- uw2-globals
- uw2-prod
- uw2-staging
- uw2-uat
env:
ENV_TEST_1: test1_override2
ENV_TEST_2: test2_override2
ENV_TEST_3: test3
ENV_TEST_4: test4
ENV_TEST_5: test5
ENV_TEST_6: test6
ENV_TEST_7: test7
ENV_TEST_8: test8
settings:
spacelift:
autodeploy: true
branch: dev
triggers: []
workspace_enabled: true
version: 0
vars:
cluster_size: 1
environment: uw2
instance_type: db.r4.xlarge
namespace: eg
region: us-west-2
stage: dev
helmfile:
alb-controller:
stacks:
- eks/eks-defaults
- uw2-dev
- uw2-prod
- uw2-staging
- uw2-uat
env: {}
settings: {}
vars:
account_number: "1234567890"
chart_values:
enableCertManager: true
environment: uw2
installed: true
namespace: eg
region: us-west-2
ssm_region: us-west-2
stage: dev
Published by Nuru over 3 years ago
Published by aknysh over 3 years ago
Add settings
sections to data_source_stack_config_yaml
data source to provide settings for Terraform and helmfile components
Add env
sections to data_source_stack_config_yaml
data source to provide ENV vars for Terraform and helmfile components
Workaround for a deep-merge bug in mergo.Merge()
Fix failing tests
Add stack_processor_test.go
settings
sections are deep-merged and used for consumption by external services (e.g. for Spacelift and Terraform Cloud Terraform modules)env
sections are deep-merged and used to specify ENV vars for consumption by external services (e.g. for Spacelift and Terraform Cloud)mergo.Merge()
. When deep-merging slice of maps in a for
loop,mergo
modifies the source of the previous loop iteration if it's a complex map and mergo
gets a pointer to it,stack_processor_test.go
to test the provider outputs using a YAML stack configGiven this config:
terraform:
vars: {}
settings:
spacelift:
workspace_enabled: false
autodeploy: false
env:
ENV_TEST_1: test1
ENV_TEST_2: test2
ENV_TEST_3: test3
aurora-postgres:
vars:
instance_type: db.r4.large
cluster_size: 1
env:
ENV_TEST_4: test4
ENV_TEST_5: test5
ENV_TEST_6: test6
ENV_TEST_7: test7
aurora-postgres-2:
component: aurora-postgres
vars:
instance_type: db.r4.xlarge
settings:
spacelift:
workspace_enabled: true
autodeploy: true
branch: "dev"
triggers: []
env:
ENV_TEST_1: test1_override2
ENV_TEST_2: test2_override2
ENV_TEST_8: test8
eks:
vars:
spotinst_instance_profile: eg-gbl-dev-spotinst-worker
spotinst_oceans:
main:
desired_group_size: 1
max_group_size: 3
min_group_size: 1
kubernetes_version: null
ami_release_version: null
attributes: null
disk_size: 100
instance_types: null
ami_type: "AL2_x86_64"
tags: null
settings:
spacelift:
workspace_enabled: true
autodeploy: true
branch: "test"
triggers: []
env:
ENV_TEST_1: test1_override
ENV_TEST_2: test2_override
ENV_TEST_4: test4
it produces the following outputs:
uw2_uat_aurora_postgres_2_settings = {
"spacelift" = {
"autodeploy" = true
"branch" = "dev"
"triggers" = []
"workspace_enabled" = true
}
}
uw2_dev_aurora_postgres_2_env = {
"ENV_TEST_1" = "test1_override2"
"ENV_TEST_2" = "test2_override2"
"ENV_TEST_3" = "test3"
"ENV_TEST_4" = "test4"
"ENV_TEST_5" = "test5"
"ENV_TEST_6" = "test6"
"ENV_TEST_7" = "test7"
"ENV_TEST_8" = "test8"
}
uw2_uat_aurora_postgres_settings = {
"spacelift" = {
"autodeploy" = false
"workspace_enabled" = false
}
}
uw2_dev_aurora_postgres_env = {
"ENV_TEST_1" = "test1"
"ENV_TEST_2" = "test2"
"ENV_TEST_3" = "test3"
"ENV_TEST_4" = "test4"
"ENV_TEST_5" = "test5"
"ENV_TEST_6" = "test6"
"ENV_TEST_7" = "test7"
}
uw2_uat_eks_settings = {
"spacelift" = {
"autodeploy" = false
"branch" = "test"
"triggers" = []
"workspace_enabled" = true
}
}
uw2_dev_eks_env = {
"ENV_TEST_1" = "test1_override"
"ENV_TEST_2" = "test2_override"
"ENV_TEST_3" = "test3"
"ENV_TEST_4" = "test4"
}
Published by aknysh over 3 years ago
component
attribute to the outputs of Terraform components that inherit from a base componentvars
from a base component aurora-postgres:
vars:
instance_type: db.r4.large
cluster_size: 2
aurora-postgres-2:
component: aurora-postgres
vars:
cluster_size: 3
instance_type: db.r4.xlarge
"aurora-postgres" = {
"backend" = {
"acl" = "bucket-owner-full-control"
"bucket" = "eg-uw2-root-tfstate"
"dynamodb_table" = "eg-uw2-root-tfstate-lock"
"encrypt" = true
"key" = "terraform.tfstate"
"region" = "us-west-2"
"role_arn" = "arn:aws:iam::XXXXXXXXXXXX:role/eg-gbl-root-terraform"
"workspace_key_prefix" = "aurora-postgres"
}
"backend_type" = "s3"
"vars" = {
"cluster_size" = 2
"environment" = "uw2"
"instance_type" = "db.r4.large"
"namespace" = "eg"
"region" = "us-west-2"
"stage" = "uat"
}
}
"aurora-postgres-2" = {
"backend" = {
"acl" = "bucket-owner-full-control"
"bucket" = "eg-uw2-root-tfstate"
"dynamodb_table" = "eg-uw2-root-tfstate-lock"
"encrypt" = true
"key" = "terraform.tfstate"
"region" = "us-west-2"
"role_arn" = "arn:aws:iam::XXXXXXXXXXXX:role/eg-gbl-root-terraform"
"workspace_key_prefix" = "aurora-postgres"
}
"backend_type" = "s3"
"component" = "aurora-postgres"
"vars" = {
"cluster_size" = 3
"environment" = "uw2"
"instance_type" = "db.r4.xlarge"
"namespace" = "eg"
"region" = "us-west-2"
"stage" = "uat"
}
}
Published by aknysh over 3 years ago
data_source_stack_config_yaml
data sourcedata_source_deep_merge_yaml
and data_source_deep_merge_json
data sourcesdata_source_stack_config_yaml
data source is used to process YAML stack configurations for Terraform and helmfile componentscomponent
attribute (inherit vars
and backend
attributes from the base component)data_source_deep_merge_yaml
and data_source_deep_merge_json
data sources was missingNOTE: terraform apply
finishes in less than a second processing the 4 stacks in the example below (including processing/deep-merging of all imports for all stacks, and deep-merging of vars
and backend
from different sections)
data "utils_stack_config_yaml" "example" {
input = [
"${path.module}/stacks/uw2-dev.yaml",
"${path.module}/stacks/uw2-prod.yaml",
"${path.module}/stacks/uw2-staging.yaml",
"${path.module}/stacks/uw2-uat.yaml"
]
}
locals {
result = [for i in data.utils_stack_config_yaml.example.output : yamldecode(i)]
}
output "output" {
value = local.result
}
output "uw2_dev_datadog_vars" {
value = local.result[0]["components"]["helmfile"]["datadog"]["vars"]
}
output "uw2_dev_eks_config" {
value = local.result[0]["components"]["terraform"]["eks"]
}
output "uw2_prod_vpc_vars" {
value = local.result[1]["components"]["terraform"]["vpc"]["vars"]
}
output "uw2_staging_aurora_postgres_backend" {
value = local.result[2]["components"]["terraform"]["aurora-postgres"]["backend"]
}
output "uw2_staging_aurora_postgres_2_backend" {
value = local.result[2]["components"]["terraform"]["aurora-postgres-2"]["backend"]
}
output "uw2_uat_aurora_postgres_vars" {
value = local.result[3]["components"]["terraform"]["aurora-postgres"]["vars"]
}
output "uw2_uat_aurora_postgres_2_vars" {
value = local.result[3]["components"]["terraform"]["aurora-postgres-2"]["vars"]
}
uw2_dev_datadog_vars = {
"account_number" = "1234567890"
"apm" = {
"enabled" = true
}
"clusterAgent" = {
"enabled" = true
}
"datadogTags" = [
"env:uw2-dev",
"region:us-west-2",
"stage:dev",
]
"environment" = "uw2"
"installed" = true
"namespace" = "eg"
"processAgent" = {
"enabled" = true
}
"region" = "us-west-2"
"ssm_region" = "us-west-2"
"stage" = "dev"
"systemProbe" = {
"enabled" = true
}
}
uw2_dev_eks_config = {
"backend" = {
"acl" = "bucket-owner-full-control"
"bucket" = "eg-uw2-root-tfstate"
"dynamodb_table" = "eg-uw2-root-tfstate-lock"
"encrypt" = true
"key" = "terraform.tfstate"
"region" = "us-west-2"
"role_arn" = "arn:aws:iam::XXXXXXXXXXXX:role/eg-gbl-root-terraform"
"workspace_key_prefix" = "eks"
}
"backend_type" = "s3"
"vars" = {
"environment" = "uw2"
"namespace" = "eg"
"region" = "us-west-2"
"region_availability_zones" = [
"us-west-2b",
"us-west-2c",
"us-west-2d",
]
"spotinst_instance_profile" = "eg-gbl-dev-spotinst-worker"
"spotinst_oceans" = {
"main" = {
"ami_release_version" = null
"ami_type" = "AL2_x86_64"
"attributes" = null
"desired_group_size" = 1
"disk_size" = 100
"instance_types" = null
"kubernetes_version" = null
"max_group_size" = 3
"min_group_size" = 1
"tags" = null
}
}
"stage" = "dev"
}
}
uw2_prod_vpc_vars = {
"availability_zones" = [
"us-west-2b",
"us-west-2c",
"us-west-2d",
]
"cidr_block" = "10.116.0.0/18"
"environment" = "uw2"
"namespace" = "eg"
"region" = "us-west-2"
"stage" = "prod"
"subnet_type_tag_key" = "eg.com/subnet/type"
"vpc_flow_logs_bucket_environment_name" = "uw2"
"vpc_flow_logs_bucket_stage_name" = "audit"
"vpc_flow_logs_enabled" = true
"vpc_flow_logs_traffic_type" = "ALL"
}
uw2_staging_aurora_postgres_2_backend = {
"acl" = "bucket-owner-full-control"
"bucket" = "eg-uw2-root-tfstate"
"dynamodb_table" = "eg-uw2-root-tfstate-lock"
"encrypt" = true
"key" = "terraform.tfstate"
"region" = "us-west-2"
"role_arn" = "arn:aws:iam::XXXXXXXXXXXX:role/eg-gbl-root-terraform"
"workspace_key_prefix" = "aurora-postgres"
}
uw2_staging_aurora_postgres_backend = {
"acl" = "bucket-owner-full-control"
"bucket" = "eg-uw2-root-tfstate"
"dynamodb_table" = "eg-uw2-root-tfstate-lock"
"encrypt" = true
"key" = "terraform.tfstate"
"region" = "us-west-2"
"role_arn" = "arn:aws:iam::XXXXXXXXXXXX:role/eg-gbl-root-terraform"
"workspace_key_prefix" = "aurora-postgres"
}
uw2_uat_aurora_postgres_2_vars = {
"cluster_size" = 3
"environment" = "uw2"
"instance_type" = "db.r4.xlarge"
"namespace" = "eg"
"region" = "us-west-2"
"stage" = "uat"
}
uw2_uat_aurora_postgres_vars = {
"cluster_size" = 2
"environment" = "uw2"
"instance_type" = "db.r4.large"
"namespace" = "eg"
"region" = "us-west-2"
"stage" = "uat"
}
Published by mcalhoun over 3 years ago
Initial provider release