Pattern: Use of sensitive info in aws_launch_configuration
Issue: -
When creating Launch Configurations, user data can be used for the initial configuration of the instance. User data must not contain any sensitive data.
Resolution: Don't use sensitive data in user data.
The following example will fail the aws-autoscaling-no-sensitive-info check.
resource "aws_launch_configuration" "as_conf" {
name = "web_config"
image_id = data.aws_ami.ubuntu.id
instance_type = "t2.micro"
user_data = <<EOF
export DATABASE_PASSWORD=\"SomeSortOfPassword\"
EOF
}
The following example will pass the aws-autoscaling-no-sensitive-info check.
resource "aws_launch_configuration" "as_conf" {
name = "web_config"
image_id = data.aws_ami.ubuntu.id
instance_type = "t2.micro"
user_data = <<EOF
export GREETING="Hello there"
EOF
}