You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Two ways I can think to fix this are either remove the id_prefix, or switch the filter_name to KeyPairIds. I think switching the filter_name is a "better" fix, but am not sure if it'll break something I'm not considering.
What did you expect to happen?
I expect a policy that runs in response to a CreateKeyPair event to match the created key.
Cloud Provider
Amazon Web Services (AWS)
Cloud Custodian version and dependency information
Describe the bug
As of custodian 0.9.12.0, CloudTrail mode policies fail to match EC2 key pair resources.
The issue seems to be that when fetching
aws.key-pair
resources by ID, it filters using key pair name but defines "key-" as an ID prefix.So with a policy event block like this, event IDs are discarded since they don't have the expected prefix:
And with an event block like this, we pull key pair IDs out of CloudTrail but feed them into a key pair name filter:
Two ways I can think to fix this are either remove the
id_prefix
, or switch thefilter_name
toKeyPairIds
. I think switching thefilter_name
is a "better" fix, but am not sure if it'll break something I'm not considering.What did you expect to happen?
I expect a policy that runs in response to a
CreateKeyPair
event to match the created key.Cloud Provider
Amazon Web Services (AWS)
Cloud Custodian version and dependency information
Policy
policies: - name: new-key-pair resource: aws.key-pair mode: type: cloudtrail role: my-role events: - source: ec2.amazonaws.com event: CreateKeyPair ids: "requestParameters.keyName"
Relevant log/traceback output
Extra information or context
No response
The text was updated successfully, but these errors were encountered: