Do you want BuboFlash to help you learning these things? Or do you want to add or correct something? Click here to log in or create user.



Question
In terraform, say you have a different required AMI for for each region, a clean way to pick the right AMI to build your EC2 instance from, based on your region (provided at "terraform apply" runtime), is to use [...] [...] .
Answer

map lookup

^^^ e.g.:

variable "amis" {
  default = {
    "us-east-1" = "ami-b374d5a5"
    "us-west-2" = "ami-4b32be2b"
  }
}

variable "region" {}

resource "aws_instance" "example" {
  ami           = "${lookup(var.amis, var.region)}"
  instance_type = "t2.micro"
}


Question
In terraform, say you have a different required AMI for for each region, a clean way to pick the right AMI to build your EC2 instance from, based on your region (provided at "terraform apply" runtime), is to use [...] [...] .
Answer
?

Question
In terraform, say you have a different required AMI for for each region, a clean way to pick the right AMI to build your EC2 instance from, based on your region (provided at "terraform apply" runtime), is to use [...] [...] .
Answer

map lookup

^^^ e.g.:

variable "amis" {
  default = {
    "us-east-1" = "ami-b374d5a5"
    "us-west-2" = "ami-4b32be2b"
  }
}

variable "region" {}

resource "aws_instance" "example" {
  ami           = "${lookup(var.amis, var.region)}"
  instance_type = "t2.micro"
}


Summary

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Details

No repetitions


Discussion

Do you want to join discussion? Click here to log in or create user.