Skip to content

Instantly share code, notes, and snippets.

@tmtk75
Last active August 29, 2015 14:22
Show Gist options
  • Select an option

  • Save tmtk75/9d871f734a0597107f67 to your computer and use it in GitHub Desktop.

Select an option

Save tmtk75/9d871f734a0597107f67 to your computer and use it in GitHub Desktop.
variable "aws_access_key" {}
variable "aws_secret_key" {}
variable "aws_region" { default = "ap-northeast-1" }
variable "your_subnet_id" { default = "subnet-9a6da0c3" }
variable "your_vpc_id" { default = "vpc-1c1fc479" }
variable "your_key_name" { default = "foo" }
provider "aws" {
access_key = "${var.aws_access_key}"
secret_key = "${var.aws_secret_key}"
region = "${var.aws_region}"
}
resource "aws_security_group" "foo" {
name = "foo"
description = "foo"
vpc_id = "${var.your_vpc_id}"
ingress {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
}
resource "aws_instance" "foo" {
ami = "ami-81294380"
instance_type = "t1.micro"
key_name = "${var.your_key_name}"
subnet_id = "${var.your_subnet_id}"
security_groups = ["${aws_security_group.foo.id}"]
associate_public_ip_address = true
root_block_device {
volume_size = 20
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment