-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathncc.tf
More file actions
79 lines (67 loc) · 2.33 KB
/
ncc.tf
File metadata and controls
79 lines (67 loc) · 2.33 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
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
# -------------------------------------------------------------------------------------
# Create NCC hub with edge and center groups for the trust VPC network.
# -------------------------------------------------------------------------------------
// Create NCC hub in star topology
resource "google_network_connectivity_hub" "main" {
count = (var.configure_ncc ? 1 : 0)
name = "${local.prefix}panw-hub"
preset_topology = "STAR"
}
// Create NCC center group for VM-Series
resource "google_network_connectivity_group" "center" {
count = (var.configure_ncc ? 1 : 0)
hub = google_network_connectivity_hub.main[0].id
name = "center"
auto_accept {
auto_accept_projects = [
var.project_id
]
}
}
// Create NCC edge group for VM-Series
resource "google_network_connectivity_group" "edge" {
count = (var.configure_ncc ? 1 : 0)
hub = google_network_connectivity_hub.main[0].id
name = "edge"
auto_accept {
auto_accept_projects = [
var.project_id
]
}
}
# -------------------------------------------------------------------------------------
# Create NCC spokes.
# -------------------------------------------------------------------------------------
// Create NCC spoke for trust VPC
resource "google_network_connectivity_spoke" "trust" {
count = (var.configure_ncc ? 1 : 0)
name = "${local.prefix}trust"
location = "global"
group = google_network_connectivity_group.center[0].id
hub = google_network_connectivity_hub.main[0].id
linked_vpc_network {
uri = google_compute_network.trust.self_link
}
}
// Create NCC spoke for spoke1-vpc
resource "google_network_connectivity_spoke" "spoke1" {
count = (var.configure_ncc ? 1 : 0)
name = "${local.prefix}spoke1"
location = "global"
group = google_network_connectivity_group.edge[0].id
hub = google_network_connectivity_hub.main[0].id
linked_vpc_network {
uri = google_compute_network.spoke1.self_link
}
}
// Create NCC spoke for spoke2-vpc
resource "google_network_connectivity_spoke" "spoke2" {
count = (var.configure_ncc ? 1 : 0)
name = "${local.prefix}spoke2"
location = "global"
group = google_network_connectivity_group.edge[0].id
hub = google_network_connectivity_hub.main[0].id
linked_vpc_network {
uri = google_compute_network.spoke2.self_link
}
}