-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathami.tf
More file actions
51 lines (40 loc) · 1.1 KB
/
ami.tf
File metadata and controls
51 lines (40 loc) · 1.1 KB
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
locals {
agent_ami_owner_linux = "309956199498" // aws
agent_ami_name_linux = "RHEL-8.9.*"
agent_ami_ssh_user_linux = "ec2-user"
agent_ami_owner_windows = "amazon"
agent_ami_name_windows = "Windows_Server-2022-English-Full-Base-*"
agent_ami_ssh_user_windows = "Administrator"
agent_ami_ssh_user = var.os_type == "Windows" ? local.agent_ami_ssh_user_windows : local.agent_ami_ssh_user_linux
}
data "aws_ami" "agent_ami_linux" {
count = var.os_type == "Windows" ? 0 : 1
most_recent = true
name_regex = local.agent_ami_name_linux
filter {
name = "virtualization-type"
values = ["hvm"]
}
filter {
name = "architecture"
values = ["x86_64"]
}
owners = [local.agent_ami_owner_linux]
}
data "aws_ami" "agent_ami_windows" {
count = var.os_type == "Windows" ? 1 : 0
most_recent = true
filter {
name = "name"
values = [local.agent_ami_name_windows]
}
filter {
name = "virtualization-type"
values = ["hvm"]
}
filter {
name = "architecture"
values = ["x86_64"]
}
owners = [local.agent_ami_owner_windows]
}