Skip to content

v2.1.0: Export block causes Error: null value is not allowed: [{{} export} {{} directory_permission}] #651

@tech-priv

Description

@tech-priv

Code of Conduct

  • I have read and agree to the Code of Conduct.
  • Vote on this issue by adding a 👍 reaction to the original issue description to help the maintainers prioritize.
  • Do not leave "+1" or other comments that do not add relevant information or questions.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Packer Version

1.15.0

Packer Plugin Version

2.1.0

Plugin Builder

  • vsphere-iso
  • vsphere-clone
  • vsphere-supervisor

Plugin Post-Processor

  • vsphere
  • vsphere-template

vSphere Version

8.0.3.00000

Description

Summary

Since upgrading from v2.0.0 to v2.1.0 of vmware/packer-plugin-vsphere, running packer validate on any template that includes an export {} block now fails with:

Error: null value is not allowed: [{{} export} {{} directory_permission}]

This is a regression since the same template validated and built successfully with v2.0.0. The directory_permission field is tagged required:"false" in the source, so omitting it should be valid.

Packer Configuration

https://gist.github.com/tech-priv/03ac8db0941028d272cd83d25c752bfb

Debug Output

https://gist.github.com/tech-priv/07b0c6adfee7a2124c1ad3deaab46eaa

Panic Output

No response

Expected Behavior

packer validate should succeed. The directory_permission field is documented as optional (required:"false"), so omitting it from the export {} block should be valid and fall back to the documented default of 0750.

This worked correctly with v2.0.0.

Actual Behavior

packer validate fails immediately with:

Error: null value is not allowed: [{{} export} {{} directory_permission}]

The error occurs even though directory_permission is not a required field. Attempts to explicitly supply the value result in further type errors:

  • Setting directory_permission = "0755"Inappropriate value for attribute "directory_permission": bool required.
  • Setting directory_permission = trueError: number value is required
  • Setting directory_permission = 0755Inappropriate value for attribute "directory_permission": bool required.
  • Setting directory_permission = 493 (decimal equivalent of octal 0755) → Inappropriate value for attribute "directory_permission": bool required.

The field appears to cycle between requiring a bool and a number, suggesting the HCL2 spec for this field is incorrectly generated.

Steps to Reproduce

  1. Install packer-plugin-vsphere v2.1.0:
packer {
  required_version = ">= 1.8.6"
  required_plugins {
    vsphere = {
      version = ">= v2.1.0"
      source  = "github.com/vmware/vsphere"
    }
  }
}
  1. Define a vsphere-iso source block with a minimal export {} block (see Gist configuration)
  2. Run with:
packer init .
packer validate .

Environment Details

No response

Screenshots

No response

References

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions