Skip to content

Instantly share code, notes, and snippets.

@kremso
Created November 27, 2017 00:22
Show Gist options
  • Select an option

  • Save kremso/a403d3eb83d8c2d0ea8db5d187014457 to your computer and use it in GitHub Desktop.

Select an option

Save kremso/a403d3eb83d8c2d0ea8db5d187014457 to your computer and use it in GitHub Desktop.
Terraform demo
$ terraform plan
$ terraform apply
provider "aws" {
region = "eu-west-1"
profile = "luigis"
}
resource "aws_instance" "demo_instance" {
count = "1"
ami = "ami-add175d4"
instance_type = "t2.nano"
associate_public_ip_address = true
vpc_security_group_ids = ["${aws_security_group.demo_instance.id}"]
tags {
Name = "Demo instance"
}
root_block_device {
volume_type = "gp2"
volume_size = "10"
}
}
resource "aws_security_group" "demo_instance" {
description = "controls access to demo instance"
name = "sgrp-demo"
ingress {
protocol = "tcp"
from_port = 80
to_port = 80
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_route53_zone" "primary" {
name = "rubyslava.local"
}
resource "aws_route53_record" "demo" {
zone_id = "${aws_route53_zone.primary.id}"
name = "demo"
type = "A"
ttl = 300
records = ["${aws_instance.demo_instance.private_ip}"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment