hashicorp / hashicorp/packer-plugin-amazon
Optional attributes for "object" types in variables?
- Dominant language
- Go
- Stars
- 91
- Forks
- 141
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 3
Description
#### Community Note
Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request.
Please do not leave "+1" or "me too" comments, 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.
#### Description
I'd like to use "object" types for variables, but where some of the attributes are not required. I'd expect, when not specified, they would evaluate to the `default` value of the attribute. As a further example of the idea, Terraform has a similar concept, that they're [currently running as an experiment](https://www.terraform.io/language/expressions/type-constraints#experimental-optional-object-type-attributes).
#### Potential configuration
```
variable "example" {
type = object({
a = string # a required attribute
b = optional(string) # an optional attribute
})
default = {
a = "foo"
b = "bar"
}
}
```
#### Potential References
Contributor guide
Assessment
This issue has not been assessed yet.