-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
feat(autoscaling): add new check autoscaling_group_using_ec2_launch_template
#5346
feat(autoscaling): add new check autoscaling_group_using_ec2_launch_template
#5346
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5346 +/- ##
==========================================
- Coverage 89.43% 89.38% -0.05%
==========================================
Files 1027 1028 +1
Lines 31531 31551 +20
==========================================
+ Hits 28200 28203 +3
- Misses 3331 3348 +17 ☔ View full report in Codecov by Sentry. |
…-groups-use-amazon-ec-2-launch-templates
@@ -0,0 +1,32 @@ | |||
{ | |||
"Provider": "aws", | |||
"CheckID": "autoscaling_group_launch_template", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"CheckID": "autoscaling_group_launch_template", | |
"CheckID": "autoscaling_group_using_ec2_launch_template", |
report.resource_tags = group.tags | ||
report.status = "PASS" | ||
report.status_extended = ( | ||
f"Autoscaling group {group.name} is using a launch template." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f"Autoscaling group {group.name} is using a launch template." | |
f"Autoscaling group {group.name} is using a EC2 launch template." |
): | ||
report.status = "FAIL" | ||
report.status_extended = ( | ||
f"Autoscaling group {group.name} is not using a launch template." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f"Autoscaling group {group.name} is not using a launch template." | |
f"Autoscaling group {group.name} is not using a EC2 launch template." |
autoscaling_group_launch_template
autoscaling_group_using_ec2_launch_template
…-groups-use-amazon-ec-2-launch-templates
Context
This new check ensures that Amazon EC2 Auto Scaling groups are created using Amazon EC2 launch templates. Using launch templates provides access to the latest features and improvements, compared to launch configurations, and allows for more flexible and efficient management of Auto Scaling group settings.
Additionally, an ASG can utilize a Mixed Instances Policy to combine different instance types within the same group. Within this policy, a Launch Template can also be specified. In this case, the
LaunchTemplate
field is located within theMixedInstancesPolicy
structure rather than at the root of the ASG.So, if we only verify the LaunchTemplate field at the ASG level, you might overlook ASGs that use Launch Templates within a Mixed Instances Policy. Therefore, to ensure thoroughness and accuracy in your verification, it is crucial to examine both locations.
Description
Added new check
autoscaling_group_launch_template
with its unit tests.Checklist
License
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.