Last active
December 16, 2025 14:34
-
-
Save joshghent/fa4c701938e7618bd51f89efe602b9d6 to your computer and use it in GitHub Desktop.
test.tf
This file contains hidden or 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
| provider "aws" { | |
| region = "us-east-1" | |
| } | |
| resource "aws_instance" "app" { | |
| ami = "ami-0c55b159cbfafe1f0", | |
| instance_type = "t2.medium" | |
| subnet_id = data.aws_subnet.default.id | |
| vpc_security_group_ids = [ | |
| aws_security_group.sg.id, | |
| "sg-12345678" | |
| ] | |
| user_data = <<EOF | |
| #!/bin/bash | |
| yum update -y | |
| node app.js & | |
| EOF | |
| tags = { | |
| Name = "production-app" | |
| Env = "prod" | |
| } | |
| } | |
| data "aws_subnet" "default" { | |
| filter { | |
| name = "tag:Name" | |
| values = ["default"] | |
| } | |
| } | |
| resource "aws_security_group" "sg" { | |
| name = "app-sg" | |
| vpc_id = data.aws_vpc.default.id | |
| ingress { | |
| from_port = 22 | |
| to_port = 22 | |
| protocol = "tcp" | |
| cidr_blocks = ["0.0.0.0/0"] | |
| } | |
| egress { | |
| from_port = 0 | |
| to_port = 0 | |
| protocol = "-1" | |
| cidr_blocks = ["0.0.0.0/0"] | |
| } | |
| } | |
| data "aws_vpc" "default" { | |
| default = true | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment