update user_data to enable nginx

This commit is contained in:
Ric Harvey 2024-04-16 17:12:40 +01:00
parent 5a4c16b8b2
commit 20fe5cb336
Signed by: ric
GPG key ID: 7FDEB4C0C7D5CB61
2 changed files with 8 additions and 0 deletions

View file

@ -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

View file

@ -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
}