Skip to content

Commit

Permalink
Add versionFingerprint to EvalContext
Browse files Browse the repository at this point in the history
  • Loading branch information
devashish-patel committed Jan 26, 2024
1 parent 10d7aed commit dea4b66
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion hcl2template/types.packer_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strings"

"github.com/gobwas/glob"
hcl "github.com/hashicorp/hcl/v2"
"github.com/hashicorp/hcl/v2"
"github.com/hashicorp/hcl/v2/hcldec"
"github.com/hashicorp/hcl/v2/hclsyntax"
packersdk "github.com/hashicorp/packer-plugin-sdk/packer"
Expand Down Expand Up @@ -128,6 +128,14 @@ func (cfg *PackerConfig) EvalContext(ctx BlockContext, variables map[string]cty.
})
}

versionFingerprint, ok := cfg.HCPVars["versionFingerprint"]
if ok {
ectx.Variables[packerAccessor] = cty.ObjectVal(map[string]cty.Value{
"version": cty.StringVal(cfg.CorePackerVersionString),
"versionFingerprint": versionFingerprint,
})
}

// In the future we'd like to load and execute HCL blocks using a graph
// dependency tree, so that any block can use any block whatever the
// order.
Expand Down

0 comments on commit dea4b66

Please sign in to comment.