Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add multiple config files support to globals #221

Merged
merged 6 commits into from
Feb 17, 2022

Conversation

katcipis
Copy link
Contributor

@katcipis katcipis commented Feb 16, 2022

This PR allows globals to be defined on multiple files. We still lack suppor to export_as_locals and generate_hcl.

Example:

#!/bin/bash

set -o errexit
set -o nounset

basedir=$(mktemp -d)

cd "${basedir}"

cat > terramate.tm.hcl <<- EOM
terramate {
  config {
  }
}
EOM

mkdir -p stacks/stack-1
mkdir -p stacks/stack-2

terramate stacks init stacks/stack-1
terramate stacks init stacks/stack-2

echo "terramate list"
echo

terramate stacks list

echo

cat > stacks/globals1.tm.hcl <<- EOM
globals {
  testing = "test value"
}
EOM

cat > stacks/globals2.tm <<- EOM
globals {
  object = {
    name = "hello"
    data = "world"
  }
}
EOM

echo "terramate stacks globals"

terramate stacks globals

@katcipis katcipis self-assigned this Feb 16, 2022
@katcipis katcipis requested a review from i4ki February 16, 2022 14:22
@katcipis katcipis marked this pull request as ready for review February 16, 2022 14:22
@codecov-commenter
Copy link

codecov-commenter commented Feb 16, 2022

Codecov Report

Merging #221 (deb6890) into main (d68152f) will increase coverage by 0.14%.
The diff coverage is 90.99%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #221      +/-   ##
==========================================
+ Coverage   63.57%   63.71%   +0.14%     
==========================================
  Files          29       29              
  Lines        5403     5438      +35     
==========================================
+ Hits         3435     3465      +30     
- Misses       1784     1789       +5     
  Partials      184      184              
Flag Coverage Δ
tests 63.71% <90.99%> (+0.14%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
globals.go 84.04% <89.39%> (-1.23%) ⬇️
hcl/hcl.go 81.53% <93.33%> (+0.50%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d68152f...deb6890. Read the comment docs.

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 a319fe2 into main Feb 17, 2022
@katcipis katcipis deleted the katcipis-multiple-config-on-code-generation branch February 17, 2022 12:00
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.

3 participants