Skip to content

[ami-housekeeper] allow customizing ParameterFilters for SSM #4259

Open
@GMartinez-Sisti

Description

@GMartinez-Sisti

Hi, I've been using ami-housekeeper for some time now, it really helps to make sure we don't end up with a lot of AMIs as I build a new one every week.

Although, today I had an issue where AMIs in use were deleted and I was able to pinpoint it to the ami-housekeeper SSM query that didn't match up our provided ssmParameterNames filter. After investigating and reading the docs again I realized that the ami-housekeeper expects the parameters to contain ami-id in the name. Initially I thought this was a suggestion, instead of a requirement since we can also customize the filter to search for parameter name using ssmParameterNames. Docs:

When you set ssmParameterNames to *ami-id, the module will regard all AMIs referenced in SSM as in use, sparing them from deletion.

I looked into the code to check how to customize it:

https://github.com/philips-labs/terraform-aws-github-runner/blob/26ad5c17181f3d904972e4e1342d2d8006afeb23/lambdas/functions/ami-housekeeper/src/ami.ts#L194-L202

and would like to add a new parameter named ssmParameterFilters to use the defaults as the current values, but allow it to be customizable so we can use any desired filter. I already have a working lambda, so please let me know if this is something that would be accepted and I would open a PR for it.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions