From 20fe5cb336680f31fe71e0690b36f2bb496f0649 Mon Sep 17 00:00:00 2001 From: Ric Harvey Date: Tue, 16 Apr 2024 17:12:40 +0100 Subject: [PATCH] update user_data to enable nginx --- 2-simple-example/README.md | 7 +++++++ 2-simple-example/code/main.tf | 1 + 2 files changed, 8 insertions(+) diff --git a/2-simple-example/README.md b/2-simple-example/README.md index bc1d56a..7de745f 100644 --- a/2-simple-example/README.md +++ b/2-simple-example/README.md @@ -17,6 +17,7 @@ resource "aws_instance" "test_ami" { user_data = <<-EOF #!/bin/bash sudo dnf install -y nginx + sudo systemctl enable nginx sudo systemctl start nginx EOF } @@ -52,6 +53,12 @@ Embedded in there you'll see something liek this ```instance_public_ip``` thats ![Default nginx page](./img/webpage.png) (I'm of course in dark mode, don't worry if yours is white with black text!) +Right we now have our basic stack to work with. Everything else we do will be to update this stack, so **don't destroy** it just yet + +#### Introducing variables + +Right this is great and all but what if we want to make it easy to change things, such as the region we are deploying in or the size of the instance we are running. This is where variables make it easy, and as an added advantage we can create variable files for different environments with different values in them. + 2. Validate diff --git a/2-simple-example/code/main.tf b/2-simple-example/code/main.tf index 14dc933..eea13d8 100644 --- a/2-simple-example/code/main.tf +++ b/2-simple-example/code/main.tf @@ -49,6 +49,7 @@ resource "aws_instance" "test_ami" { user_data = <<-EOF #!/bin/bash sudo dnf install -y nginx + sudo systemctl enable nginx sudo systemctl start nginx EOF }