Closed hoshsadiq closed 5 years ago
How does your source_ami_filters
look?
Ah sorry! This is it:
"source_ami_filter": {
"filters": {
"name": "hosh-windows-server-2016-Core-*",
"virtualization-type": "hvm",
"root-device-type": "ebs",
"tag:mytag": "false"
},
"owners": [
"<account>"
],
"most_recent": true
},
Currently I've gone around it by appending a binary value at the end of name, e.g. for true hosh-windows-server-2016-Core-*-mytag
, for false hosh-windows-server-2016-Core-*-mytagfalse
kind of thing.
The API doesn't support globs.
EDIT: It does, but not regexps.
It does. I'm not using regexps. Anyway, been using the glob for a while and it's been working. This is about the tag not being matched. Happy to try and provide you with a minimal packer.json config to reproduce but the main thing is that you need an AMI with a tag that you want to filter on, and then the filters I posted before and it won't find it.
Not matching the tag is quite weird, as I'm guessing packer directly sends the tags json to the AWS API. Really strange.
Yes we are just passing this to the AWS API so I think there is something we are missing. Are you using the same credentials? Tags are only visible in the account where they exists. Even if the AMI is shared with another account that can't see the tags in the owning account.
Ah! That's a good point I forgot about. That's exactly what it is!
:+1:
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.
I'm currently trying to filter the source ami through tags. When I remove the tag filter, it works fine. Trying the same using aws cli it finds the AMI correctly.