Skip to content

Commit

Permalink
hcl2template: remove value validation for locals
Browse files Browse the repository at this point in the history
Local variables can't have a validation block in their definition, so
this step in not useful and should be removed.

Besides, since the validation was done on the local variables before
evaluation, it did nothing at all, as the PackerConfig.LocalVariables
collection gets populated during evaluation, so this is essentially a
no-op, and can be safely removed.
  • Loading branch information
lbajolet-hashicorp committed Sep 6, 2023
1 parent 48e8c3e commit f5ffc11
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion hcl2template/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@ func filterVarsFromLogs(inputOrLocal Variables) {

func (cfg *PackerConfig) Initialize(opts packer.InitializeOptions) hcl.Diagnostics {
diags := cfg.InputVariables.ValidateValues()
diags = append(diags, cfg.LocalVariables.ValidateValues()...)
diags = append(diags, cfg.evaluateDatasources(opts.SkipDatasourcesExecution)...)
diags = append(diags, checkForDuplicateLocalDefinition(cfg.LocalBlocks)...)
diags = append(diags, cfg.evaluateLocalVariables(cfg.LocalBlocks)...)
Expand Down

0 comments on commit f5ffc11

Please sign in to comment.