This commit is contained in:
Edward Viaene
2016-10-10 12:14:31 +00:00
parent 6648f1365f
commit 1b1b0ed203
3 changed files with 29 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
resource "aws_instance" "example" {
ami = "${lookup(var.AMIS, var.AWS_REGION)}"
instance_type = "t2.micro"
provisioner "local-exec" {
command = "echo ${aws_instance.example.private_ip} >> private_ips.txt"
}
}
output "ip" {
value = "${aws_instance.example.public_ip}"
}
+6
View File
@@ -0,0 +1,6 @@
provider "aws" {
access_key = "${var.AWS_ACCESS_KEY}"
secret_key = "${var.AWS_SECRET_KEY}"
region = "${var.AWS_REGION}"
}
+13
View File
@@ -0,0 +1,13 @@
variable "AWS_ACCESS_KEY" {}
variable "AWS_SECRET_KEY" {}
variable "AWS_REGION" {
default = "eu-west-1"
}
variable "AMIS" {
type = "map"
default = {
us-east-1 = "ami-13be557e"
us-west-2 = "ami-06b94666"
eu-west-1 = "ami-844e0bf7"
}
}