Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Interconnect fail_open field #19572

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changelog/11746.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
```release-note:bug
compute: added `macsec.fail_open` field to `google_compute_interconnect`
```
```release-note:deprecation
compute: deprecated `macsec.pre_shared_keys.fail_open` field in `google_compute_interconnect`. Use the new `macsec.fail_open` field instead
```
31 changes: 29 additions & 2 deletions google/services/compute/resource_compute_interconnect.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,9 @@ or re-establishing a MACsec secure link.`,
letter, or digit, except the last character, which cannot be a dash.`,
},
"fail_open": {
Type: schema.TypeBool,
Optional: true,
Type: schema.TypeBool,
Optional: true,
Deprecated: "`failOpen` is deprecated and will be removed in a future major release. Use other `failOpen` instead.",
Description: `If set to true, the Interconnect connection is configured with a should-secure
MACsec security policy, that allows the Google router to fallback to cleartext
traffic if the MKA session cannot be established. By default, the Interconnect
Expand All @@ -183,6 +184,15 @@ hours apart.`,
},
},
},
"fail_open": {
Type: schema.TypeBool,
Optional: true,
Description: `If set to true, the Interconnect connection is configured with a should-secure
MACsec security policy, that allows the Google router to fallback to cleartext
traffic if the MKA session cannot be established. By default, the Interconnect
connection is configured with a must-secure security policy that drops all traffic
if the MKA session cannot be established with your router.`,
},
},
},
},
Expand Down Expand Up @@ -1106,6 +1116,8 @@ func flattenComputeInterconnectMacsec(v interface{}, d *schema.ResourceData, con
transformed := make(map[string]interface{})
transformed["pre_shared_keys"] =
flattenComputeInterconnectMacsecPreSharedKeys(original["preSharedKeys"], d, config)
transformed["fail_open"] =
flattenComputeInterconnectMacsecFailOpen(original["failOpen"], d, config)
return []interface{}{transformed}
}
func flattenComputeInterconnectMacsecPreSharedKeys(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
Expand Down Expand Up @@ -1140,6 +1152,10 @@ func flattenComputeInterconnectMacsecPreSharedKeysFailOpen(v interface{}, d *sch
return v
}

func flattenComputeInterconnectMacsecFailOpen(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}

func flattenComputeInterconnectMacsecEnabled(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
Expand Down Expand Up @@ -1231,6 +1247,13 @@ func expandComputeInterconnectMacsec(v interface{}, d tpgresource.TerraformResou
transformed["preSharedKeys"] = transformedPreSharedKeys
}

transformedFailOpen, err := expandComputeInterconnectMacsecFailOpen(original["fail_open"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedFailOpen); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["failOpen"] = transformedFailOpen
}

return transformed, nil
}

Expand Down Expand Up @@ -1282,6 +1305,10 @@ func expandComputeInterconnectMacsecPreSharedKeysFailOpen(v interface{}, d tpgre
return v, nil
}

func expandComputeInterconnectMacsecFailOpen(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}

func expandComputeInterconnectMacsecEnabled(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ resource "google_compute_interconnect" "example-interconnect" {
name = "test-key"
start_time = "2023-07-01T21:00:01.000Z"
}
fail_open = true
}
}
`, context)
Expand Down
12 changes: 11 additions & 1 deletion website/docs/r/compute_interconnect.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,14 @@ The following arguments are supported:
or re-establishing a MACsec secure link.
Structure is [documented below](#nested_pre_shared_keys).

* `fail_open` -
(Optional)
If set to true, the Interconnect connection is configured with a should-secure
MACsec security policy, that allows the Google router to fallback to cleartext
traffic if the MKA session cannot be established. By default, the Interconnect
connection is configured with a must-secure security policy that drops all traffic
if the MKA session cannot be established with your router.


<a name="nested_pre_shared_keys"></a>The `pre_shared_keys` block supports:

Expand All @@ -176,13 +184,15 @@ The following arguments are supported:
hours apart.

* `fail_open` -
(Optional)
(Optional, Deprecated)
If set to true, the Interconnect connection is configured with a should-secure
MACsec security policy, that allows the Google router to fallback to cleartext
traffic if the MKA session cannot be established. By default, the Interconnect
connection is configured with a must-secure security policy that drops all traffic
if the MKA session cannot be established with your router.

~> **Warning:** `failOpen` is deprecated and will be removed in a future major release. Use other `failOpen` instead.

## Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:
Expand Down