feat: Add variable for configuring Karpenter Cloudwatch Event rule name prefix #3589
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Added variable
rule_name_use_terraform_prefixto the Karpenter submodule that allows disabling the Terraform generated suffix to Cloudwatch Event rules generated by the submodule.Motivation and Context
When directly using the Karpenter submodule, there is no configuration present to disable the Terraform suffix applied to the Cloudwatch Event rules. I personally ran into the problem of hitting the AWS imposed length limit of 64.
The Cloudwatch Event rule for the InstanceStateChange rule, for example, uses 46 characters for the "InstanceStateChange-" part plus the 26 characters of Terraform's auto-generated suffix, leaving only 18 characters left for the user inputted
rule_name_prefix.Breaking Changes
Backwards compatibility is provided because the variable is optional and defaults to the previous behavior when omitted.
How Has This Been Tested?
Because of how small this change is, I just tested it by replacing the source of the Karpenter module in my code to my PR repo, and tested that:
rule_name_use_terraform_prefixvariable resulted in no changes and no errorsrule_name_use_terraform_prefixvariable totrue(default) resulted in no changes and no errorsrule_name_use_terraform_prefixvariable tofalseresulted in renaming of the Cloudwatch Event rules and no errorsexamples/*to demonstrate and validate my change(s)examples/*projectspre-commit run -aon my pull request