Thanks for the report. This does not seem to be working as documented.
As a workaround you can try to specify this as a comma-delimited string, which I think will be converted into a list internally. Not sure if you'll run into the same problem, though, depending on where the type coercion is failing.
With comma-delimited string - working. Thanks!
Easy to fix, I will have a look.
any news about this issue?
This works as expected in 0.11.0.
I can't find that this have been fixed and don't see that it have been broken in near time.
Please reopen if you can repro this with 0.11.0 and provide a full template to repro this.
I think this problem still exists? Here is a template that can be used to reproduce:
{
"variables": {
"ami_users": []
}
}
Running Packer on this template gives the following error:
Failed to parse template: 1 error(s) occurred:
* variable ami_users: '' expected type 'string', got unconvertible type '[]interface {}'
@joshuaspence ~That's not the same error, and~ it's not a bug. Variables can't be arrays.
Try:
{
"variables": { "ami_users": "123456789012,987654321098" },
"builders": [
{
"type": "amazon-ebs",
"ami_users": "{{ user `ami_users` }}"
}
]
}
What do you mean? The error message I got is exactly as in the original report. I thought that this issue was regarding the ability to specify ami_users
as an array rather than as a comma-separated list.
Sorry read a bit to quickly, nevertheless you have the solution above.
I'm confused. Can I use an array of strings for this attribute or not?
The docs specify ami_users ([]string)
but it seems it doesn't work
Hey @jakub-bochenski, yes, you can set it to []
or ["xxx", "xxx"]
.
I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Most helpful comment
Hey @jakub-bochenski, yes, you can set it to
[]
or["xxx", "xxx"]
.