Prevent cloud misconfigurations and find vulnerabilities during build-time in infrastructure as code, container images and open source packages with Checkov by Bridgecrew.
Describe the issue
The documentation for CKV_AWS_315 - EC2 Auto Scaling groups are not utilizing EC2 launch templates - states to use launch templates over launch configurations. However, auto scaling groups can use launch templates via a LaunchTemplate block, or within a MixedInstancesPolicy. The Terraform check at AutoScalingLaunchTemplate.py only checks for launch_template. When using a mixed_instances_policy, the launch_template definition is within that block. An AutoScaling Group that wants to use different instance types (for instance Graviton and Intel), along with Spot/OnDemand, will use a Mixed Instances Policy and possibly attach multiple Launch Templates. This check should allow for that type of configuration.
Examples
Example of a launch template is being used with specific instance types as choices.
In both of the above cases, launch templates (and not launch configurations) are being used, which should be allowed.
Version (please complete the following information):
Checkov 3.2.30
Additional context
While launch templates should always form the basis for autoscaling group configuration, advanced configurations that leverage multiple instance types, different weighted capacities, different architecture, and other advanced configurations need to be done at the autoscaling group layer with the launch template within a deeper block.
Describe the issue The documentation for CKV_AWS_315 - EC2 Auto Scaling groups are not utilizing EC2 launch templates - states to use launch templates over launch configurations. However, auto scaling groups can use launch templates via a LaunchTemplate block, or within a MixedInstancesPolicy. The Terraform check at AutoScalingLaunchTemplate.py only checks for
launch_template
. When using amixed_instances_policy
, thelaunch_template
definition is within that block. An AutoScaling Group that wants to use different instance types (for instance Graviton and Intel), along with Spot/OnDemand, will use a Mixed Instances Policy and possibly attach multiple Launch Templates. This check should allow for that type of configuration.Examples Example of a launch template is being used with specific instance types as choices.
Example of multiple launch templates being used to leverage both Intel(AMD) and Graviton instance types.
In both of the above cases, launch templates (and not launch configurations) are being used, which should be allowed.
Version (please complete the following information):
Additional context While launch templates should always form the basis for autoscaling group configuration, advanced configurations that leverage multiple instance types, different weighted capacities, different architecture, and other advanced configurations need to be done at the autoscaling group layer with the launch template within a deeper block.