-
Notifications
You must be signed in to change notification settings - Fork 2
/
image.tf
30 lines (26 loc) · 816 Bytes
/
image.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
# this code creates an AMI image for launch configuration
data "aws_ami" "image" {
most_recent = true
# filtering is for name, vir-type and owners of ubuntu
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"]
}
filter {
name = "virtualization-type"
values = ["hvm"]
}
owners = ["099720109477"] # Canonical
}
# by defining availability zones as all, we make it highly available
# as we might use as many AZs as posible in the region
data "aws_availability_zones" "all" {}
# display availability zones
output "AZ" {
value = data.aws_availability_zones.all.names
}
# if we own our own ami then we would have given this image request code for image
# data "aws_ami" "company" {
# most_recent = true
# owners = ["self"] # Canonical
# }