Skip to content

v0.7.0

Compare
Choose a tag to compare
@cloudpossebot cloudpossebot released this 08 Feb 05:26
· 73 commits to main since this release
813df73
Use `terraform-provider-utils` Terraform provider for the module and all submodules @aknysh (#8)

what

  • Use terraform-provider-utils Terraform provider for the module and all submodules
  • Add examples/stacks example
  • Update the module and all submodules to the latest context.tf and terraform-null-label

why

  • Speed up the stack processing (especially for SaaS as Spacelift where all components from all stacks are processed at once)
  • Return vars and backend configurations for all Terraform and helmfile components for all the provided stacks at the same time
  • Support unlimited imports and unlimited levels of imports in YAML configs

references

test

terraform config

NOTE: In the example below, using version 0.2.0 of the terraform-provider-utils provider, terraform apply finishes in about a second processing all the Terraform and helmfile components from the 4 stacks (including processing/deep-merging of all imports for all stacks, and deep-merging of vars and backend from different config sections)

    module "stacks" {
      source = "cloudposse/stack-config/yaml"
      # version     = "x.x.x"
    
      stack_config_local_path = "./stacks"

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

outputs

config = [
  {
    "components" = {
      "helmfile" = {
        "alb-controller" = {
          "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"
          }
        }
        "cert-manager" = {
          "vars" = {
            "account_number" = "1234567890"
            "environment" = "uw2"
            "installed" = true
            "namespace" = "eg"
            "region" = "us-west-2"
            "ssm_region" = "us-west-2"
            "stage" = "dev"
          }
        }
      }
      "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"
          "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"
          "vars" = {
            "cluster_size" = 1
            "environment" = "uw2"
            "instance_type" = "db.r4.xlarge"
            "namespace" = "eg"
            "region" = "us-west-2"
            "stage" = "dev"
          }
        }
        "eks" = {
          "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"
          }
        }
       "tfstate-backend" = {
          "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" = null
            "workspace_key_prefix" = "tfstate-backend"
          }
          "backend_type" = "s3"
          "vars" = {
            "environment" = "uw2"
            "namespace" = "eg"
            "region" = "us-west-2"
            "stage" = "dev"
          }
        }
        "vpc" = {
          "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" = "vpc"
          }
          "backend_type" = "s3"
          "vars" = {
            "availability_zones" = [
              "us-west-2b",
              "us-west-2c",
              "us-west-2d",
            ]
            "cidr_block" = "10.114.0.0/18"
            "environment" = "uw2"
            "namespace" = "eg"
            "region" = "us-west-2"
            "stage" = "dev"
            "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"
          }
        }
      }
    }
  }
]