mirror of
https://github.com/opentffoundation/opentf.git
synced 2025-12-25 01:00:16 -05:00
Handle static variable secret flag (#2045)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
||||
"github.com/opentofu/opentofu/internal/configs"
|
||||
"github.com/opentofu/opentofu/internal/encryption/config"
|
||||
"github.com/opentofu/opentofu/internal/lang"
|
||||
"github.com/opentofu/opentofu/internal/lang/marks"
|
||||
|
||||
"github.com/hashicorp/hcl/v2"
|
||||
"github.com/hashicorp/hcl/v2/gohcl"
|
||||
@@ -187,6 +188,14 @@ func (e *targetBuilder) setupKeyProvider(cfg config.KeyProviderConfig, stack []c
|
||||
return diags
|
||||
}
|
||||
|
||||
// gohcl does not handle marks, we need to remove the sensitive marks from any input variables
|
||||
// We assume that the entire configuration in the encryption block should be treated as sensitive
|
||||
for key, sv := range evalCtx.Variables {
|
||||
if marks.Contains(sv, marks.Sensitive) {
|
||||
evalCtx.Variables[key], _ = sv.UnmarkDeep()
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize the Key Provider
|
||||
decodeDiags := gohcl.DecodeBody(cfg.Body, evalCtx, keyProviderConfig)
|
||||
diags = append(diags, decodeDiags...)
|
||||
|
||||
Reference in New Issue
Block a user