github.com/dahs81/otto@v0.2.1-0.20160126165905-6400716cf085/builtin/app/ruby/data/aws-simple/deploy/main.tf.tpl (about) 1 # Generated by Otto, do not edit manually 2 3 variable "infra_id" {} 4 variable "aws_access_key" {} 5 variable "aws_secret_key" {} 6 variable "aws_region" {} 7 variable "key_name" {} 8 9 variable "ami" {} 10 variable "instance_type" { default = "t2.micro" } 11 variable "subnet_public" {} 12 variable "vpc_cidr" {} 13 variable "vpc_id" {} 14 15 provider "aws" { 16 access_key = "${var.aws_access_key}" 17 secret_key = "${var.aws_secret_key}" 18 region = "${var.aws_region}" 19 } 20 21 resource "aws_security_group" "app" { 22 name = "{{ name }}-${var.infra_id}" 23 vpc_id = "${var.vpc_id}" 24 25 ingress { 26 protocol = -1 27 from_port = 0 28 to_port = 0 29 cidr_blocks = ["0.0.0.0/0"] 30 } 31 32 egress { 33 protocol = -1 34 from_port = 0 35 to_port = 0 36 cidr_blocks = ["0.0.0.0/0"] 37 } 38 } 39 40 resource "aws_instance" "app" { 41 ami = "${var.ami}" 42 instance_type = "${var.instance_type}" 43 subnet_id = "${var.subnet_public}" 44 key_name = "${var.key_name}" 45 46 vpc_security_group_ids = ["${aws_security_group.app.id}"] 47 48 tags { Name = "{{ name }}" } 49 } 50 51 output "url" { 52 value = "http://${aws_instance.app.public_dns}/" 53 }