Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@fatih
Created September 16, 2015 12:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fatih/e93aa6f6e9a763ec5957 to your computer and use it in GitHub Desktop.
Save fatih/e93aa6f6e9a763ec5957 to your computer and use it in GitHub Desktop.
variable "environment_name" {
default = "fatih-testing"
}
provider "aws" {
region = "ap-northeast-1"
}
resource "aws_vpc" "default" {
cidr_block = "10.0.0.0/16"
tags {
Name = "${var.environment_name}"
}
}
resource "aws_subnet" "default" {
vpc_id = "${aws_vpc.default.id}"
cidr_block = "10.0.0.0/16"
map_public_ip_on_launch = true
tags {
Name = "${var.environment_name}"
}
}
resource "aws_security_group" "default" {
name = "arslan_sg_testing"
description = "Used by Arslan for testing"
vpc_id = "${aws_vpc.default.id}"
ingress {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
ingress {
from_port = 80
to_port = 80
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"]
}
}
resource "aws_instance" "web" {
instance_type = "t2.micro"
ami = "ami-9e5cff9e"
subnet_id = "${aws_subnet.default.id}"
security_groups = ["${aws_security_group.default.id}"]
tags {
Name = "${var.environment_name}"
}
count = 3
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment