manheim / manheim-c7n-tools

Manheim's Cloud Custodian (c7n) wrapper package, policy generator, runner, and supporting tools.
https://manheim-c7n-tools.readthedocs.io/
Apache License 2.0
45 stars 25 forks source link

--step=mugc ignores mode.function-prefix #53

Closed IngussNeilands closed 4 years ago

IngussNeilands commented 4 years ago

This might be feature request or bug - not sure.

Custodian Policy and Mugc supports configurable lambda function-prefix: https://github.com/cloud-custodian/cloud-custodian/blob/63121e9273ceb5fbe04338520835c2964a6cef24/c7n/policy.py#L348 https://github.com/cloud-custodian/cloud-custodian/blob/a203a6e53393ff64105d3f6311d94b2b123888ea/tools/ops/mugc.py#L169

When I specify function-prefix in defaults.yml, it deploys lambda with expected prefix

But --step=mugc ignores it and tries to remove all policy lambdas with default custodian- name prefix

Expected functionality - configurable lambda function prefix per account

jantman commented 4 years ago

@IngussNeilands I'd say this is a feature request - we don't use function-prefix ourselves, and it appears that none of our other users do either. This is the first time I've heard of this issue.

The issue appears to be here and here where we pass mugc the custodian- prefix as a literal string instead of looking in the config object.

This should be a relatively simple fix... we need a new field added to the ManheimConfig object (and the example manheim-c7n-tools.yml file and docs) for this, and then use the value of that field instead of the current hard-coded string.

I'm not sure when we'll be able to get around to this as our team has been quite busy lately, but PRs are always welcome, and we'll try to get around to it sometime in the next week or two if nobody else does first.

Thanks so much for reporting this!

jantman commented 4 years ago

I'm working on an implementation to fix this right now.

jantman commented 4 years ago

Thanks so much for reporting this, @IngussNeilands! A fix has been released as 1.2.4, which is now live on PyPI and the Docker Hub.

IngussNeilands commented 4 years ago

👍