Skip to content

Commit 9d0e963

Browse files
committed
add encryption support
Signed-off-by: Ricky Hariady <[email protected]>
1 parent 5dab24a commit 9d0e963

File tree

6 files changed

+41
-17
lines changed

6 files changed

+41
-17
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ Functional examples are included in the [examples](./examples/) directory. By de
4444
|------|-------------|------|---------|:--------:|
4545
| bgp | BGP information specific to this router. | <pre>object({<br> asn = string<br> advertise_mode = optional(string, "CUSTOM")<br> advertised_groups = optional(list(string))<br> advertised_ip_ranges = optional(list(object({<br> range = string<br> description = optional(string)<br> })), [])<br> keepalive_interval = optional(number)<br> })</pre> | `null` | no |
4646
| description | An optional description of this resource | `string` | `null` | no |
47+
| encrypted\_interconnect\_router | An optional field to indicate if a router is dedicated to use with encrypted Interconnect Attachment | `bool` | `false` | no |
4748
| name | Name of the router | `string` | n/a | yes |
4849
| nats | NATs to deploy on this router. | <pre>list(object({<br> name = string<br> nat_ip_allocate_option = optional(string)<br> source_subnetwork_ip_ranges_to_nat = optional(string)<br> nat_ips = optional(list(string), [])<br> drain_nat_ips = optional(list(string), [])<br> min_ports_per_vm = optional(number)<br> max_ports_per_vm = optional(number)<br> udp_idle_timeout_sec = optional(number)<br> icmp_idle_timeout_sec = optional(number)<br> tcp_established_idle_timeout_sec = optional(number)<br> tcp_transitory_idle_timeout_sec = optional(number)<br> tcp_time_wait_timeout_sec = optional(number)<br> enable_endpoint_independent_mapping = optional(bool)<br> enable_dynamic_port_allocation = optional(bool)<br><br> log_config = optional(object({<br> enable = optional(bool, true)<br> filter = optional(string, "ALL")<br> }), {})<br><br> subnetworks = optional(list(object({<br> name = string<br> source_ip_ranges_to_nat = list(string)<br> secondary_ip_range_names = optional(list(string))<br> })), [])<br><br> }))</pre> | `[]` | no |
4950
| network | A reference to the network to which this router belongs | `string` | n/a | yes |

main.tf

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@
1515
*/
1616

1717
resource "google_compute_router" "router" {
18-
name = var.name
19-
network = var.network
20-
region = var.region
21-
project = var.project
22-
description = var.description
18+
name = var.name
19+
network = var.network
20+
region = var.region
21+
project = var.project
22+
description = var.description
23+
encrypted_interconnect_router = var.encrypted_interconnect_router
2324

2425
dynamic "bgp" {
2526
for_each = var.bgp != null ? [var.bgp] : []

modules/interconnect_attachment/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@
99
| bandwidth | Provisioned bandwidth capacity for the interconnect attachment | `string` | `"BPS_10G"` | no |
1010
| candidate\_subnets | Up to 16 candidate prefixes that can be used to restrict the allocation of cloudRouterIpAddress and customerRouterIpAddress for this attachment. All prefixes must be within link-local address space (169.254.0.0/16) and must be /29 or shorter (/28, /27, etc). | `list(string)` | `null` | no |
1111
| description | An optional description of this resource | `string` | `null` | no |
12+
| encryption | Indicates the user-supplied encryption option of this interconnect attachment. | `string` | `"NONE"` | no |
1213
| interconnect | URL of the underlying Interconnect object that this attachment's traffic will traverse through. | `string` | n/a | yes |
1314
| interface | Interface to deploy for this attachment. | <pre>object({<br> name = string<br> })</pre> | n/a | yes |
15+
| ipsec\_internal\_addresses | URL of addresses that have been reserved for the interconnect attachment, Used only for interconnect attachment that has the encryption option as IPSEC. | `list(string)` | `[]` | no |
1416
| mtu | Maximum Transmission Unit (MTU), in bytes, of packets passing through this interconnect attachment. Currently, only 1440 and 1500 are allowed. If not specified, the value will default to 1440. | `string` | `null` | no |
1517
| name | The name of the interconnect attachment | `string` | n/a | yes |
1618
| peer | BGP Peer for this attachment. | <pre>object({<br> name = string<br> peer_asn = string<br> advertised_route_priority = optional(number)<br> bfd = optional(object({<br> session_initialization_mode = string<br> min_transmit_interval = optional(number)<br> min_receive_interval = optional(number)<br> multiplier = optional(number)<br> }))<br> })</pre> | n/a | yes |

modules/interconnect_attachment/main.tf

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,20 @@
1515
*/
1616

1717
resource "google_compute_interconnect_attachment" "attachment" {
18-
name = var.name
19-
router = var.router
20-
project = var.project
21-
region = var.region
22-
interconnect = var.interconnect
23-
admin_enabled = var.admin_enabled
24-
type = var.type
25-
description = var.description
26-
bandwidth = var.bandwidth
27-
mtu = var.mtu
28-
candidate_subnets = var.candidate_subnets
29-
vlan_tag8021q = var.vlan_tag8021q
18+
name = var.name
19+
router = var.router
20+
project = var.project
21+
region = var.region
22+
interconnect = var.interconnect
23+
admin_enabled = var.admin_enabled
24+
type = var.type
25+
description = var.description
26+
bandwidth = var.bandwidth
27+
mtu = var.mtu
28+
candidate_subnets = var.candidate_subnets
29+
vlan_tag8021q = var.vlan_tag8021q
30+
encryption = var.encryption
31+
ipsec_internal_addresses = var.ipsec_internal_addresses
3032
}
3133

3234
module "interface" {

modules/interconnect_attachment/variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,18 @@ variable "vlan_tag8021q" {
8181
default = null
8282
}
8383

84+
variable "encryption" {
85+
type = string
86+
description = "Indicates the user-supplied encryption option of this interconnect attachment."
87+
default = "NONE"
88+
}
89+
90+
variable "ipsec_internal_addresses" {
91+
type = list(string)
92+
description = "URL of addresses that have been reserved for the interconnect attachment, Used only for interconnect attachment that has the encryption option as IPSEC."
93+
default = []
94+
}
95+
8496
variable "interface" {
8597
description = "Interface to deploy for this attachment."
8698
type = object({

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ variable "description" {
4040
default = null
4141
}
4242

43+
variable "encrypted_interconnect_router" {
44+
type = bool
45+
description = "An optional field to indicate if a router is dedicated to use with encrypted Interconnect Attachment"
46+
default = false
47+
}
48+
4349
# Type: object, with fields:
4450
# - asn (string, required): Local BGP Autonomous System Number (ASN).
4551
# - advertised_groups (list(string), optional): User-specified list of prefix groups to advertise.

0 commit comments

Comments
 (0)