Skip to content

Commit

Permalink
AMI lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubuntu committed Oct 7, 2016
1 parent 4e07803 commit 83f0fc4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
8 changes: 1 addition & 7 deletions demo-1/instance.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
provider "aws" {
access_key = "ACCESS_KEY_HERE"
secret_key = "SECRET_KEY_HERE"
region = "us-east-1"
}

resource "aws_instance" "example" {
ami = "ami-0d729a60"
ami = "${lookup(var.AMIS, var.AWS_REGION)}"
instance_type = "t2.micro"
}
8 changes: 8 additions & 0 deletions demo-1/vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,11 @@ 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-0d729a60"
}
}

0 comments on commit 83f0fc4

Please sign in to comment.