-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
40 lines (34 loc) · 816 Bytes
/
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
terraform {
required_version = "~> 1.2"
required_providers {
vcd = {
source = "vmware/vcd"
version = "~> 3.8"
}
}
}
# Create the Datacenter Group data source
data "vcd_vdc_group" "dcgroup" {
org = var.vdc_org_name
name = var.vdc_group_name
}
resource "vcd_nsxt_dynamic_security_group" "group" {
for_each = var.dynamic_security_groups
org = var.vdc_org_name
vdc_group_id = data.vcd_vdc_group.dcgroup.id
name = each.key
description = each.value.description
dynamic "criteria" {
for_each = each.value.criteria
content {
dynamic "rule" {
for_each = [criteria.value]
content {
type = rule.value.type
operator = rule.value.operator
value = rule.value.value
}
}
}
}
}