terramate
terramate copied to clipboard
feat: add global unset
Reason for This Change
Add support to set a global to unset
, which unsets the global. References to it will fail as if the global was never defined.
Description of Changes
Changed globals evaluation, removing any globals set to unset
before starting the evaluation process.
Example
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail
workdir="$(mktemp -d)"
cd "${workdir}"
cat > terramate.tm.hcl <<- EOM
terramate {
config {
}
}
EOM
cat > globals.tm.hcl <<- EOM
globals {
a = 1
b = 2
}
EOM
terramate create stacks/stack-1
terramate create stacks/stack-2
cat > stacks/stack-1/globals.tm.hcl <<- EOM
globals {
a = unset
}
EOM
cat > stacks/stack-2/globals.tm.hcl <<- EOM
globals {
b = unset
}
EOM
terramate experimental globals
Will result in the globals being:
stack "/stacks/stack-1":
b = 2
stack "/stacks/stack-2":
a = 1
Codecov Report
Merging #528 (0e3c751) into main (b938d18) will increase coverage by
0.01%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## main #528 +/- ##
==========================================
+ Coverage 70.11% 70.13% +0.01%
==========================================
Files 52 52
Lines 9126 9138 +12
==========================================
+ Hits 6399 6409 +10
- Misses 2426 2427 +1
- Partials 301 302 +1
Flag | Coverage Δ | |
---|---|---|
tests | 70.13% <100.00%> (+0.01%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
Impacted Files | Coverage Δ | |
---|---|---|
stack/globals.go | 90.64% <100.00%> (+0.58%) |
:arrow_up: |
stack/clone.go | 74.76% <0.00%> (-1.87%) |
:arrow_down: |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.