-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Open
Labels
bugstage/waiting-on-upstreamThis issue is waiting on an upstream changeThis issue is waiting on an upstream changesync to jiraFor issues that need to be imported to Packer internal JIRA backlogFor issues that need to be imported to Packer internal JIRA backlog
Milestone
Description
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Overview of the Issue
Using optional in variables of type object isn't working in Packer, but working in Terraform.
Reproduction Steps
# foo.pkr.hcl
variable "context" {
type = object({
bar_pro = optional(string, "bar")
})
}
$> packer validate foo.pkr.hcl
Error: Invalid type specification
on foo.pkr.hcl line 3, in variable "context":
3: bar_pro = optional(string, "bar")
Optional attribute modifier is only for type constraints, not for exact types.
# main.tf has exactly same content as foo.pkr.hcl
# tf init etc ommited
$> terraform validate
Success! The configuration is valid.
Packer version
Packer v1.8.5
Terraform v1.3.6
Operating system and Environment details
Linux fedora 6.0.15-300.fc37.x86_64
thenger, sestegra, aidanleuck, c33s, richsim and 13 more
Metadata
Metadata
Assignees
Labels
bugstage/waiting-on-upstreamThis issue is waiting on an upstream changeThis issue is waiting on an upstream changesync to jiraFor issues that need to be imported to Packer internal JIRA backlogFor issues that need to be imported to Packer internal JIRA backlog