Skip to content

Commit 8f61b06

Browse files
committed
introduce argument to optionally create interface
1 parent c969152 commit 8f61b06

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

modules/interconnect_attachment/README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@
66
| Name | Description | Type | Default | Required |
77
|------|-------------|------|---------|:--------:|
88
| admin\_enabled | Whether the VLAN attachment is enabled or disabled | `bool` | `true` | no |
9-
| bandwidth | Provisioned bandwidth capacity for the interconnect attachment | `string` | `"BPS_10G"` | no |
9+
| bandwidth | Provisioned bandwidth capacity for the interconnect attachment | `string` | `null` | 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 |
11+
| create\_interface | Whether to create router interface (and peer) for this attachment. Set this to false for PARTNER type. | `bool` | `true` | no |
1112
| description | An optional description of this resource | `string` | `null` | no |
1213
| encryption | Indicates the user-supplied encryption option of this interconnect attachment. | `string` | `"NONE"` | no |
13-
| interconnect | URL of the underlying Interconnect object that this attachment's traffic will traverse through. | `string` | n/a | yes |
14-
| interface | Interface to deploy for this attachment. | <pre>object({<br> name = string<br> })</pre> | n/a | yes |
14+
| interconnect | URL of the underlying Interconnect object that this attachment's traffic will traverse through. | `string` | `""` | no |
15+
| interface | Interface to deploy for this attachment. | <pre>object({<br/> name = string<br/> })</pre> | `null` | no |
1516
| 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 |
1617
| 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 |
1718
| name | The name of the interconnect attachment | `string` | n/a | yes |
18-
| 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 |
19+
| 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> | `null` | no |
1920
| project | The project ID to deploy to | `string` | n/a | yes |
2021
| region | Region where the attachment resides | `string` | n/a | yes |
2122
| router | Name of the router the attachment resides | `string` | n/a | yes |

modules/interconnect_attachment/main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ resource "google_compute_interconnect_attachment" "attachment" {
3232
}
3333

3434
module "interface" {
35+
count = var.create_interface ? 1 : 0
36+
3537
source = "../interface"
3638
name = var.interface.name
3739
project = var.project

modules/interconnect_attachment/variables.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ variable "region" {
3737
variable "interconnect" {
3838
type = string
3939
description = "URL of the underlying Interconnect object that this attachment's traffic will traverse through."
40+
default = ""
4041
}
4142

4243
variable "admin_enabled" {
@@ -93,11 +94,18 @@ variable "ipsec_internal_addresses" {
9394
default = []
9495
}
9596

97+
variable "create_interface" {
98+
type = bool
99+
description = "Whether to create router interface (and peer) for this attachment. Set this to false for PARTNER type."
100+
default = true
101+
}
102+
96103
variable "interface" {
97104
description = "Interface to deploy for this attachment."
98105
type = object({
99106
name = string
100107
})
108+
default = null
101109
}
102110

103111
variable "peer" {
@@ -113,4 +121,5 @@ variable "peer" {
113121
multiplier = optional(number)
114122
}))
115123
})
124+
default = null
116125
}

0 commit comments

Comments
 (0)