Limit SecurityGroups Packer can use

Packer’s documentation claims that it is possible to restrict/limit the SecurityGroups that Packer can use, by taking advantage of the packer prefix[1] of the SecurityGroupName. I do not see how to do this, since IAM only allows you to restrict based on the SecurityGroupId[2], not the SecurityGroupName.

[1]https://packer.io/docs/builders/amazon-ebs.html (search for “prefix packer” in the page)
[2]https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazonec2.html#amazonec2-security-group

Any help would be appreciated. Thank you,