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

Add support for new property of azurerm_network_connection_monitor #13518

Merged
merged 1 commit into from
Oct 12, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,15 @@ func resourceNetworkConnectionMonitor() *pluginsdk.Resource {
Optional: true,
Default: true,
},

"destination_port_behavior": {
Type: pluginsdk.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{
string(network.DestinationPortBehaviorNone),
string(network.DestinationPortBehaviorListenIfAvailable),
}, false),
},
},
},
},
Expand Down Expand Up @@ -821,10 +830,16 @@ func expandNetworkConnectionMonitorTCPConfiguration(input []interface{}) *networ

v := input[0].(map[string]interface{})

return &network.ConnectionMonitorTCPConfiguration{
result := &network.ConnectionMonitorTCPConfiguration{
Port: utils.Int32(int32(v["port"].(int))),
DisableTraceRoute: utils.Bool(!v["trace_route_enabled"].(bool)),
}

if destinationPortBehavior := v["destination_port_behavior"].(string); destinationPortBehavior != "" {
result.DestinationPortBehavior = network.DestinationPortBehavior(destinationPortBehavior)
}

return result
}

func expandNetworkConnectionMonitorIcmpConfiguration(input []interface{}) *network.ConnectionMonitorIcmpConfiguration {
Expand Down Expand Up @@ -1163,10 +1178,16 @@ func flattenNetworkConnectionMonitorTCPConfiguration(input *network.ConnectionMo
port = *input.Port
}

var destinationPortBehavior network.DestinationPortBehavior
if input.DestinationPortBehavior != "" {
destinationPortBehavior = input.DestinationPortBehavior
}

return []interface{}{
map[string]interface{}{
"trace_route_enabled": enableTraceRoute,
"port": port,
"trace_route_enabled": enableTraceRoute,
"port": port,
"destination_port_behavior": string(destinationPortBehavior),
},
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,8 @@ resource "azurerm_network_connection_monitor" "test" {
protocol = "Tcp"

tcp_configuration {
port = 80
port = 80
destination_port_behavior = "None"
}
}

Expand Down Expand Up @@ -516,7 +517,8 @@ resource "azurerm_network_connection_monitor" "test" {
preferred_ip_version = "IPv4"

tcp_configuration {
port = 80
port = 80
destination_port_behavior = "ListenIfAvailable"
}

success_threshold {
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/network_connection_monitor.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ A `tcp_configuration` block supports the following:

* `trace_route_enabled` - (Optional) Should path evaluation with trace route be enabled? Defaults to `true`.

* `destination_port_behavior` - (Optional) The destination port behavior for the Tcp connection. Possible values are `None` and `ListenIfAvailable`.

---

A `test_group` block supports the following:
Expand Down