-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathinterconnect.tf
More file actions
84 lines (76 loc) · 2.88 KB
/
Copy pathinterconnect.tf
File metadata and controls
84 lines (76 loc) · 2.88 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
78
79
80
81
82
83
# Copyright 2023-2024 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
resource "google_compute_router" "interconnect-router" {
name = var.ic_router_name
network = local.network_name
project = var.host_project_id
region = var.region
bgp {
asn = var.ic_router_bgp_asn
advertise_mode = var.ic_router_advertise_mode
advertised_groups = var.ic_router_advertise_groups
dynamic "advertised_ip_ranges" {
for_each = concat(var.user_specified_ip_range, ["${local.private_ip_address}/${local.private_ip_address_prefix_length}"])
iterator = item
content {
range = item.value
}
}
}
}
module "vlan_attachment_a" {
source = "../../modules/net-vlan-attachment"
network = local.network_name
project_id = var.host_project_id
region = var.region
name = var.first_va_name
description = var.first_va_description
peer_asn = var.first_va_asn
router_config = {
create = var.create_first_vc_router
name = var.ic_router_name
}
dedicated_interconnect_config = {
bandwidth = var.first_va_bandwidth
bgp_range = var.first_va_bgp_range
//URL of the underlying Interconnect object that this attachment's traffic will traverse through.
interconnect = "projects/${local.interconnect_project_id}/global/interconnects/${local.first_interconnect_name}"
vlan_tag = var.first_vlan_tag
project = local.interconnect_project_id
}
depends_on = [
google_compute_router.interconnect-router
]
}
module "vlan_attachment_b" {
source = "../../modules/net-vlan-attachment"
network = local.network_name
project_id = var.host_project_id
region = var.region
name = var.second_va_name
description = var.second_va_description
peer_asn = var.second_va_asn
router_config = {
create = var.create_second_vc_router
name = var.ic_router_name
}
dedicated_interconnect_config = {
bandwidth = var.second_va_bandwidth
bgp_range = var.second_va_bgp_range //candidate_subnet
//URL of the underlying Interconnect object that this attachment's traffic will traverse through.
interconnect = "projects/${local.interconnect_project_id}/global/interconnects/${local.second_interconnect_name}"
vlan_tag = var.second_vlan_tag
project = local.interconnect_project_id
}
depends_on = [
google_compute_router.interconnect-router
]
}