Created
August 29, 2021 07:21
-
-
Save HVHO/e6a40f6a795d5cad26732ed184362297 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_instance" "example" { | |
ami = "ami-0ba5cd124d7a79612" | |
instance_type = "t2.micro" | |
vpc_security_group_ids = [aws_security_group.instance.id] | |
user_data = <<-EOF | |
#!/bin/bash | |
echo "Hello, World" > index.html | |
nohup busybox httpd -f -p 8080 & | |
EOF | |
tags = { | |
Name = "terraform-example" | |
} | |
} | |
resource "aws_security_group" "instance" { | |
name = "terraform-example-instance" | |
ingress { | |
from_port = 8080 | |
to_port = 8080 | |
protocol = "tcp" | |
cidr_blocks = ["0.0.0.0/0"] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment