github cloudposse/atmos 1.1.0

latest releases: v1.88.1, v1, v1.88.0...
2 years ago
Add `terraform generate backend` command @aknysh (#57)

what

  • Add terraform generate backend command
  • Fix terraform workspace calculation for derived components

why

  • Generate backend files for components from YAML config
  • Works with catalog (when YAML config for a component is defined in a catalog file for a component and imported into a top-level stack)
  • The old atmos used the format <stack-derived-component for workspaces of derived components

test

atmos terraform generate backend test/test-component-override -s tenant1-ue2-dev


Processing and merging configurations in the following order: system dir, home dir, current dir, ENV vars
No config found in /usr/local/etc/atmos/atmos.yaml
No config found in /Users/andriyknysh/.atmos/atmos.yaml
Found config in /Users/andriyknysh/Documents/Projects/Go/src/github.com/cloudposse/atmos/atmos.yaml
Processed config /Users/andriyknysh/Documents/Projects/Go/src/github.com/cloudposse/atmos/atmos.yaml

Stack 'tenant1-ue2-dev' matches the stack name pattern '{tenant}-{environment}-{stage}'

Final CLI configuration:
components:
  terraform:
    base_path: ./examples/complete/components/terraform
    apply_auto_approve: false
  helmfile:
    base_path: ./examples/complete/components/helmfile
    kubeconfig_path: /dev/shm
    helm_aws_profile_pattern: '{namespace}-{tenant}-gbl-{stage}-helm'
    cluster_name_pattern: '{namespace}-{tenant}-{environment}-{stage}-eks-cluster'
stacks:
  base_path: ./examples/complete/stacks
  included_paths:
  - '**/*'
  excluded_paths:
  - globals/**/*
  - catalog/**/*
  - '**/*globals*'
  name_pattern: '{tenant}-{environment}-{stage}'


Found config files:
- tenant1/ue2/dev.yaml
- tenant1/ue2/prod.yaml
- tenant1/ue2/staging.yaml
- tenant2/ue2/dev.yaml
- tenant2/ue2/prod.yaml
- tenant2/ue2/staging.yaml

Searching for stack config where the component 'test/test-component-override' is defined
Found stack config for component 'test/test-component-override' in stack 'tenant1/ue2/dev'


Component backend config:

{
  "terraform": {
    "backend": {
      "s3": {
        "key": "terraform.tfstate",
        "profile": "eg-gbl-root-terraform",
        "region": "us-east-2",
        "workspace_key_prefix": "test-component",
        "acl": "bucket-owner-full-control",
        "bucket": "eg-ue2-root-tfstate",
        "dynamodb_table": "eg-ue2-root-tfstate-lock",
        "encrypt": true
      }
    }
  }
}

Writing backend config to file:
./examples/complete/components/terraform/test/test-component/backend.tf.json

image

Don't miss a new atmos release

NewReleases is sending notifications on new releases.