mirror of
https://github.com/farcasclaudiu/terraform-course.git
synced 2026-06-22 07:01:56 +03:00
AMI lookup
This commit is contained in:
+1
-7
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user