Skip to content

Instantly share code, notes, and snippets.

@hexmode
Created November 27, 2015 15:51
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 hexmode/85a30fb963b1718249ac to your computer and use it in GitHub Desktop.
Save hexmode/85a30fb963b1718249ac to your computer and use it in GitHub Desktop.
variable "region" {default = "us-west-1"}
variable "cidr" {default = "10.0.0.0/24"}
variable "debian-jessie" {default = "ami-0343ae47"}
variable "ssh-key" {default = "id_rsa"}
variable "access_key" {}
variable "secret_key" {}
provider "aws" {
access_key = "${var.access_key}"
secret_key = "${var.secret_key}"
region = "${var.region}"
}
resource "aws_vpc" "main" {
cidr_block = "${var.cidr}"
}
resource "aws_subnet" "main" {
vpc_id = "${aws_vpc.main.id}"
cidr_block = "${var.cidr}"
map_public_ip_on_launch = true
}
resource "aws_instance" "example" {
ami = "${var.debian-jessie}"
key_name = "${var.ssh-key}"
instance_type = "t2.micro"
subnet_id = "${aws_subnet.main.id}"
}
resource "aws_internet_gateway" "gw" {
vpc_id = "${aws_vpc.main.id}"
}
resource "aws_eip" "main" {
instance = "${aws_instance.example.id}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment