-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
45 lines (38 loc) · 1.11 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
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
}
# Create the NSX-T Edge Gateway data source
data "vcd_nsxt_edgegateway" "t1" {
org = var.vdc_org_name
owner_id = data.vcd_vdc_group.dcgroup.id
name = var.vdc_edge_name
}
resource "vcd_network_routed_v2" "org_vdc_routed_network" {
org = var.vdc_org_name
for_each = var.segments
name = each.key
edge_gateway_id = data.vcd_nsxt_edgegateway.t1.id
gateway = each.value.gateway
prefix_length = each.value.prefix_length
dns1 = each.value.dns1
dns2 = each.value.dns2
dns_suffix = each.value.dns_suffix
dynamic "static_ip_pool" {
for_each = each.value.pool_ranges
content {
start_address = static_ip_pool.value.start_address
end_address = static_ip_pool.value.end_address
}
}
}