diff --git a/hcl2template/types.packer_config.go b/hcl2template/types.packer_config.go
index <HASH>..<HASH> 100644
--- a/hcl2template/types.packer_config.go
+++ b/hcl2template/types.packer_config.go
@@ -155,6 +155,7 @@ func (c *PackerConfig) evaluateLocalVariable(local *Local) hcl.Diagnostics {
 		return diags
 	}
 	c.LocalVariables[local.Name] = &Variable{
+		Name:         local.Name,
 		DefaultValue: value,
 		Type:         value.Type(),
 	}
evaluateLocalVariable: also pass the variable name