broke out each step of the chapter so far

master
Some guy named Michael 6 months ago
parent 526fc6600b
commit 38d335bc81
No known key found for this signature in database

@ -1,4 +1,5 @@
## Amazon AMIs
### Region: us-east-2
| Image name |Architecture| AMI ID |
|---------------------|------------|---------------------|

@ -0,0 +1,32 @@
provider "aws" {
region = "us-east-2"
}
resource "aws_instance" "cloudbuntu" {
ami = "ami-0862be96e41dcbf74"
instance_type = "t2.micro"
vpc_security_group_ids = [aws_security_group.cloudwall.id]
user_data = <<-EOF
#!/bin/bash
echo "Hello, World! I'm $(hostname)!" > index.html
nohup busybox httpd -f -p 8080 &
EOF
user_data_replace_on_change = true
tags = {
Name = "terraform-example"
}
}
resource "aws_security_group" "cloudwall" {
name = "terraform-example.instance"
ingress {
from_port = 8080
to_port = 8080
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
}

@ -0,0 +1,43 @@
variable "http_port" {
description = "Port to listen for HTTP requests on"
default = 8080
type = number
}
output "public_ip" {
value = aws_instance.cloudbuntu.public_ip
description = "The public IP of our new cloudbuntu!"
}
provider "aws" {
region = "us-east-2"
}
resource "aws_instance" "cloudbuntu" {
ami = "ami-0862be96e41dcbf74"
instance_type = "t2.micro"
vpc_security_group_ids = [aws_security_group.cloudwall.id]
user_data = <<-EOF
#!/bin/bash
echo "Hello, World! I'm $(hostname)!" > index.html
nohup busybox httpd -f -p ${var.http_port} &
EOF
user_data_replace_on_change = true
tags = {
Name = "terraform-example"
}
}
resource "aws_security_group" "cloudwall" {
name = "terraform-example.instance"
ingress {
from_port = var.http_port
to_port = var.http_port
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
}
Loading…
Cancel
Save