-
Notifications
You must be signed in to change notification settings - Fork 13
/
ubuntu-versions.tf
77 lines (68 loc) · 1.87 KB
/
ubuntu-versions.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
##############################################
# Get latest Ubuntu Linux AMI with Terraform #
##############################################
# Get latest Ubuntu Linux Trusty Tahr 14.04 AMI
data "aws_ami" "ubuntu-linux-1404" {
most_recent = true
owners = ["099720109477"] # Canonical
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-trusty-14.04-amd64-server-*"]
}
filter {
name = "virtualization-type"
values = ["hvm"]
}
}
# Get latest Ubuntu Linux Xenial Xerus 16.04 AMI
data "aws_ami" "ubuntu-linux-1604" {
most_recent = true
owners = ["099720109477"] # Canonical
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-*"]
}
filter {
name = "virtualization-type"
values = ["hvm"]
}
}
# Get latest Ubuntu Linux Bionic Beaver 18.04 AMI
data "aws_ami" "ubuntu-linux-1804" {
most_recent = true
owners = ["099720109477"] # Canonical
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-*"]
}
filter {
name = "virtualization-type"
values = ["hvm"]
}
}
# Get latest Ubuntu Linux Focal Fossa 20.04 AMI
data "aws_ami" "ubuntu-linux-2004" {
most_recent = true
owners = ["099720109477"] # Canonical
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"]
}
filter {
name = "virtualization-type"
values = ["hvm"]
}
}
# output Ubuntu AMI IDs
# output "ubuntu_1404_ami_id" {
# value = data.aws_ami.ubuntu-linux-1404.id
# }
# output "ubuntu_1604_ami_id" {
# value = data.aws_ami.ubuntu-linux-1604.id
# }
# output "ubuntu_1804_ami_id" {
# value = data.aws_ami.ubuntu-linux-1804.id
# }
# output "ubuntu_2004_ami_id" {
# value = data.aws_ami.ubuntu-linux-2004.id
# }