Created
December 28, 2016 20:39
-
-
Save mooyoul/2f16311eab27fa5cb0efb039e6b6a86a to your computer and use it in GitHub Desktop.
Terraform 101 - Maps
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
provider "aws" { | |
access_key = "${var.access_key}" | |
secret_key = "${var.secret_key}" | |
region = "${var.region}" | |
} | |
resource "aws_instance" "example" { | |
ami = "${lookup(var.amis, var.region)}" | |
instance_type = "t2.micro" | |
provisioner "local-exec" { | |
command = "echo ${aws_instance.example.public_ip} > ip_address.txt" | |
} | |
} | |
resource "aws_eip" "ip" { | |
instance = "${aws_instance.example.id}" | |
depends_on = ["aws_instance.example"] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment