Back to articles
Mastering Basic Infrastructure with Terraform
How-ToDevOps

Mastering Basic Infrastructure with Terraform

via Dev.tomarvintowett

Yesterday we deployed our first server. Today we level up. We will learn one of the most important principles in Terraform — and in software engineering generally — which is  DRY: Don't Repeat Yourself . We will apply it by deploying a configurable web server using input variables, then take it further by deploying a clustered web server capable of handling real traffic. By the end of today we will understand what separates a toy deployment from production-ready infrastructure. We will continue using our code from yesterday's session and improve on it. Here is our starting point: provider "aws" { region = "us-west-2" } resource "aws_instance" "example" { ami = "ami-0735c191cf914754d" instance_type = "t3.micro" vpc_security_group_ids = [ aws_security_group . instance . id ] tags = { Name = "mk-terraform-example" } user_data = <<- EOF #!/bin/bash echo "Hello, World" > index.html nohup busybox httpd -f -p 8080 & EOF user_data_replace_on_change = true } resource "aws_security_group" "insta

Continue reading on Dev.to

Opens in a new tab

Read Full Article
2 views

Related Articles