Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter out None elasticbeanstalk envs #9453

Merged
merged 8 commits into from
May 22, 2024

Conversation

dmytro-afanasiev
Copy link
Collaborator

describe_environments returns terminated environments (at least those that were terminated recently) but list_tags_for_resource raises ResourceNotFoundException if we try it with terminated environment.

Image
image

So, if i try to execute the policy below over my two terminated envs,

policies:
  - name: example-policy
    resource: aws.elasticbeanstalk-environment

i'll get such a result (example-policy/resources.json):

[
  null,
  null
]

It happens because _eb_env_tags returns None in case it cannot fetch tags for an environment. I'm not sure about the fix. Maybe we should just keep the environment without fetched tags, i.e return eb_env without changes if ResourceNotFoundException?

@kapilt
Copy link
Collaborator

kapilt commented Apr 26, 2024

It feels like the fix is two fold, handle better on not getting tags, but also default to listing active/pending environments.

@dmytro-afanasiev
Copy link
Collaborator Author

It feels like the fix is two fold, handle better on not getting tags, but also default to listing active/pending environments.

Rewrote to return just empty tags

Copy link
Member

@ajkerrigan ajkerrigan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good 👍 .

To @kapilt 's point I could see it being useful to default to IncludedDeleted=False and allow query overrides... but that feels like an enhancement while this is a more targeted fix.

@ajkerrigan ajkerrigan merged commit 09b15ce into cloud-custodian:main May 22, 2024
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants