-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
94 lines (84 loc) · 2.67 KB
/
main.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
resource "azurerm_container_group" "this" {
name = var.container_instance_name
location = var.location
sku = var.sku
os_type = var.os_type
resource_group_name = var.resource_group_name
restart_policy = var.restart_policy
ip_address_type = var.ip_address_type
subnet_ids = var.subnet_ids
tags = var.tags
dynamic "identity" {
for_each = (var.enable_system_assigned_identity || var.identity_ids != null) ? [1] : []
content {
type = join(", ", compact([
var.enable_system_assigned_identity ? "SystemAssigned" : "",
var.identity_ids != null ? "UserAssigned" : ""
]))
identity_ids = var.identity_ids
}
}
dynamic "image_registry_credential" {
for_each = var.image_registry_credential
content {
server = image_registry_credential.value.server
username = image_registry_credential.value.username
password = image_registry_credential.value.password
user_assigned_identity_id = image_registry_credential.value.user_assigned_identity_id
}
}
dynamic "container" {
for_each = var.containers
content {
name = container.value.name
cpu = container.value.cpu
image = container.value.image
memory = container.value.memory
environment_variables = container.value.environment_variables
dynamic "ports" {
for_each = container.value.ports_tcp
content {
port = ports.value
protocol = "TCP"
}
}
dynamic "ports" {
for_each = container.value.ports_udp
content {
port = ports.value
protocol = "UDP"
}
}
dynamic "volume" {
for_each = container.value.volumes
content {
name = volume.value.name
mount_path = volume.value.mount_path
storage_account_name = volume.value.storage_account_name
storage_account_key = volume.value.storage_account_key
share_name = volume.value.share_name
}
}
}
}
dynamic "exposed_port" {
for_each = var.exposed_ports_tcp
content {
port = exposed_port.value
protocol = "TCP"
}
}
dynamic "exposed_port" {
for_each = var.exposed_ports_udp
content {
port = exposed_port.value
protocol = "UDP"
}
}
dynamic "dns_config" {
for_each = length(var.dns_config_nameservers) != 0 ? [1] : []
content {
nameservers = var.dns_config_nameservers
}
}
}