-
-
Save dunguyenn/b29b97af38bd830deb9330ef711a0432 to your computer and use it in GitHub Desktop.
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 = "eu-west-1" | |
} | |
data "aws_availability_zones" "available" {} | |
resource "aws_security_group" "instance" { | |
name = "go-api-instance" | |
ingress { | |
from_port = 80 | |
to_port = 80 | |
protocol = "tcp" | |
cidr_blocks = ["0.0.0.0/0"] | |
} | |
ingress { | |
from_port = 22 | |
to_port = 22 | |
protocol = "tcp" | |
cidr_blocks = ["0.0.0.0/0"] | |
} | |
egress { | |
from_port = 0 | |
to_port = 65535 | |
protocol = "tcp" | |
cidr_blocks = ["0.0.0.0/0"] | |
} | |
} | |
resource "aws_launch_configuration" "example" { | |
image_id = "ami-58d7e821" | |
instance_type = "t2.micro" | |
key_name = "testInstanceKeyPair" | |
security_groups = ["${aws_security_group.instanced.id}"] | |
user_data = "${file("setup.sh")}" | |
lifecycle { | |
create_before_destroy = true | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment