From 0b31270c46c5eaf950aeef95ad7758d614c427fc Mon Sep 17 00:00:00 2001 From: Edward Viaene Date: Mon, 11 May 2020 22:11:52 +0200 Subject: [PATCH] updated user_data for newer ubuntu releases --- demo-16/autoscaling.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo-16/autoscaling.tf b/demo-16/autoscaling.tf index 6d2047b..8e88406 100644 --- a/demo-16/autoscaling.tf +++ b/demo-16/autoscaling.tf @@ -4,7 +4,7 @@ resource "aws_launch_configuration" "example-launchconfig" { instance_type = "t2.micro" key_name = aws_key_pair.mykeypair.key_name security_groups = [aws_security_group.myinstance.id] - user_data = "#!/bin/bash\napt-get update\napt-get -y install nginx\nMYIP=`ifconfig | grep 'addr:10' | awk '{ print $2 }' | cut -d ':' -f2`\necho 'this is: '$MYIP > /var/www/html/index.html" + user_data = "#!/bin/bash\napt-get update\napt-get -y install net-tools nginx\nMYIP=`ifconfig | grep -E '(inet 10)|(addr:10)' | awk '{ print $2 }' | cut -d ':' -f2`\necho 'this is: '$MYIP > /var/www/html/index.html" lifecycle { create_before_destroy = true }