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

feat(autoscaling): add new check autoscaling_group_launch_configuration_requires_imdsv2 #5356

Conversation

danibarranqueroo
Copy link
Member

Context

This check ensures that IMDSv2 is enabled on all instances launched by Amazon EC2 Auto Scaling groups. The check fails if the Instance Metadata Service (IMDS) version is not specified in the launch configuration or if it is set to token optional, allowing the use of either IMDSv1 or IMDSv2.

Description

Added new check autoscaling_group_launch_configuration_requires_imdsv2with 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.

@danibarranqueroo danibarranqueroo requested review from a team as code owners October 10, 2024 07:50
@github-actions github-actions bot added the provider/aws Issues/PRs related with the AWS provider label Oct 10, 2024
Copy link

codecov bot commented Oct 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.45%. Comparing base (3c929bd) to head (4b962cb).
Report is 6 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5356      +/-   ##
==========================================
+ Coverage   89.43%   89.45%   +0.01%     
==========================================
  Files        1027     1034       +7     
  Lines       31531    31758     +227     
==========================================
+ Hits        28200    28408     +208     
- Misses       3331     3350      +19     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@sergargar sergargar Oct 11, 2024

Choose a reason for hiding this comment

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

Please, change the autoscaling_client.launch_configurations to a dict so it is easier to handle it in this check.

Copy link
Member

Choose a reason for hiding this comment

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

Please, use the ARN as the key of the dict.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done! 👍

@sergargar sergargar self-requested a review October 14, 2024 17:08
@sergargar sergargar merged commit 808fa96 into master Oct 14, 2024
11 checks passed
@sergargar sergargar deleted the PRWLR-4288-add-new-auto-scaling-check-to-ensure-ec-2-instances-require-imd-sv-2 branch October 14, 2024 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
provider/aws Issues/PRs related with the AWS provider
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants