2018-05-09 07:38:05 +02:00
|
|
|
locals {
|
|
|
|
# Pick a CoreOS Container Linux derivative
|
|
|
|
# coreos-stable -> Container Linux AMI
|
|
|
|
# flatcar-stable -> Flatcar Linux AMI
|
2019-05-28 05:42:48 +02:00
|
|
|
ami_id = local.flavor == "flatcar" ? data.aws_ami.flatcar.image_id : data.aws_ami.coreos.image_id
|
2018-05-15 08:38:16 +02:00
|
|
|
|
2019-05-28 05:42:48 +02:00
|
|
|
flavor = element(split("-", var.os_image), 0)
|
|
|
|
channel = element(split("-", var.os_image), 1)
|
2018-05-09 07:38:05 +02:00
|
|
|
}
|
|
|
|
|
2018-02-27 07:16:34 +01:00
|
|
|
data "aws_ami" "coreos" {
|
|
|
|
most_recent = true
|
|
|
|
owners = ["595879546273"]
|
|
|
|
|
|
|
|
filter {
|
|
|
|
name = "architecture"
|
|
|
|
values = ["x86_64"]
|
|
|
|
}
|
|
|
|
|
|
|
|
filter {
|
|
|
|
name = "virtualization-type"
|
|
|
|
values = ["hvm"]
|
|
|
|
}
|
|
|
|
|
|
|
|
filter {
|
|
|
|
name = "name"
|
2018-05-09 07:38:05 +02:00
|
|
|
values = ["CoreOS-${local.channel}-*"]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
data "aws_ami" "flatcar" {
|
|
|
|
most_recent = true
|
|
|
|
owners = ["075585003325"]
|
|
|
|
|
|
|
|
filter {
|
|
|
|
name = "architecture"
|
|
|
|
values = ["x86_64"]
|
|
|
|
}
|
|
|
|
|
|
|
|
filter {
|
|
|
|
name = "virtualization-type"
|
|
|
|
values = ["hvm"]
|
|
|
|
}
|
|
|
|
|
|
|
|
filter {
|
|
|
|
name = "name"
|
|
|
|
values = ["Flatcar-${local.channel}-*"]
|
2018-02-27 07:16:34 +01:00
|
|
|
}
|
|
|
|
}
|
2019-05-28 05:42:48 +02:00
|
|
|
|