updated user_data for newer ubuntu releases

This commit is contained in:
Edward Viaene
2020-05-11 22:11:52 +02:00
parent 23055ff932
commit 0b31270c46
+1 -1
View File
@@ -4,7 +4,7 @@ resource "aws_launch_configuration" "example-launchconfig" {
instance_type = "t2.micro" instance_type = "t2.micro"
key_name = aws_key_pair.mykeypair.key_name key_name = aws_key_pair.mykeypair.key_name
security_groups = [aws_security_group.myinstance.id] 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 { lifecycle {
create_before_destroy = true create_before_destroy = true
} }