1234567891011121314151617181920212223242526272829 |
- {% import 'variables.include' as var %}
- #############
- # New method: Search for it!
- data "aws_ami" "ubuntu" {
- most_recent = true
- filter {
- name = "name"
- values = ["ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-*"]
- }
- filter {
- name = "virtualization-type"
- values = ["hvm"]
- }
- owners = ["099720109477"] # Canonical
- }
- # Use via: ami = "${data.aws_ami.ubuntu.id}"
- #############
- # Old fashioned method, manual mapping:
- variable "ubuntu_amis" {
- type = "map"
- default = {
- us-east-1 = "ami-40d28157"
- us-east-2 = "ami-153e6470"
- }
- }
- # Use with: ami = "${lookup(var.ubuntu_amis, var.region)}"
|