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"] } }