class Terracop::Cop::Aws::PreferLaunchTemplates

This cop warns against an ingress rule from 0.0.0.0/0 on port 22 (SSH). That is a Very Bad Idea™.

@example

# bad
resource "aws_launch_configuration" "lc" {}

resource "aws_autoscaling_group" "asg" {
  launch_configuration = aws_launch_configuration.lc.name
}

# good
resource "aws_launch_template" "tpl" {}

resource "aws_autoscaling_group" "asg" {
  launch_template {
    id      = aws_launch_template.tpl.id
    version = "$Latest"
  }
}

Public Instance Methods

check() click to toggle source
# File lib/terracop/cop/aws/prefer_launch_templates.rb, line 32
def check
  if type == 'aws_launch_configuration' ||
     attributes['launch_configuration']
    offense('Prefer Launch Templates to Launch Configurations.')
  end
end