Skip to content

Conversation

katcipis
Copy link
Contributor

@katcipis katcipis commented Dec 14, 2021

Introduces referencing metadata on backend configuration.

Here is an example script:

#!/bin/bash

set -o errexit
set -o nounset

basedir=$(mktemp -d)

cd "${basedir}"

mkdir -p envs/prod/stack
terramate init envs/prod/stack

mkdir -p envs/staging/stack
terramate init envs/staging/stack

echo "listing stacks:"
echo

terramate list

echo

cat > envs/staging/terramate.tm.hcl <<- EOM
terramate {
  backend "gcs" {
    bucket = "the-bucket-staging"
    prefix = terramate.path
  }
}
EOM

cat > envs/prod/terramate.tm.hcl <<- EOM
terramate {
  backend "gcs" {
    bucket = "the-bucket-prod"
    prefix = terramate.path
  }
}
EOM

echo "files before code generation:"

tree

echo

echo "=== generating code ==="
echo

terramate generate

echo "files after code generation:"

tree

echo

echo "generated code for staging:"

cat envs/staging/stack/_gen_terramate.tm.tf

echo
echo "generated code for prod:"

cat envs/prod/stack/_gen_terramate.tm.tf

@katcipis katcipis self-assigned this Dec 14, 2021
@katcipis katcipis marked this pull request as ready for review December 15, 2021 19:51
i4ki
i4ki previously approved these changes Dec 16, 2021
Copy link
Contributor

@i4ki i4ki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Contributor

@i4ki i4ki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@katcipis katcipis merged commit 787f91d into main Dec 16, 2021
@katcipis katcipis deleted the katcipis-add-metadata-backend-config branch December 16, 2021 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants