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

azurerm_spring_cloud_service - support for outbound_type property #22596

Merged
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
18 changes: 18 additions & 0 deletions internal/services/springcloud/spring_cloud_service_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,17 @@ func resourceSpringCloudService() *pluginsdk.Resource {
ForceNew: true,
},

"outbound_type": {
Type: pluginsdk.TypeString,
Optional: true,
ForceNew: true,
Default: "loadBalancer",
ValidateFunc: validation.StringInSlice([]string{
"loadBalancer",
"userDefinedRouting",
}, false),
},

"read_timeout_seconds": {
Type: pluginsdk.TypeInt,
Optional: true,
Expand Down Expand Up @@ -858,6 +869,7 @@ func expandSpringCloudNetwork(input []interface{}) *appplatform.NetworkProfile {
ServiceRuntimeSubnetID: utils.String(v["service_runtime_subnet_id"].(string)),
AppSubnetID: utils.String(v["app_subnet_id"].(string)),
ServiceCidr: utils.String(strings.Join(*cidrRanges, ",")),
OutboundType: utils.String(v["outbound_type"].(string)),
}
if readTimeoutInSeconds := v["read_timeout_seconds"].(int); readTimeoutInSeconds != 0 {
network.IngressConfig = &appplatform.IngressConfig{
Expand Down Expand Up @@ -1289,6 +1301,11 @@ func flattenSpringCloudNetwork(input *appplatform.NetworkProfile) []interface{}
}
}

outboundType := "loadBalancer"
if input.OutboundType != nil {
outboundType = *input.OutboundType
}

if serviceRuntimeSubnetID == "" && appSubnetID == "" && serviceRuntimeNetworkResourceGroup == "" && appNetworkResourceGroup == "" && len(cidrRanges) == 0 {
return []interface{}{}
}
Expand All @@ -1301,6 +1318,7 @@ func flattenSpringCloudNetwork(input *appplatform.NetworkProfile) []interface{}
"app_network_resource_group": appNetworkResourceGroup,
"read_timeout_seconds": readTimeoutInSeconds,
"service_runtime_network_resource_group": serviceRuntimeNetworkResourceGroup,
"outbound_type": outboundType,
},
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,7 @@ resource "azurerm_spring_cloud_service" "test" {
service_runtime_subnet_id = azurerm_subnet.test2.id
cidr_ranges = ["10.4.0.0/16", "10.5.0.0/16", "10.3.0.1/16"]
read_timeout_seconds = 2
outbound_type = "loadBalancer"
}

config_server_git_setting {
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/spring_cloud_service.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ The `network` block supports the following:

* `app_network_resource_group` - (Optional) Specifies the Name of the resource group containing network resources of Azure Spring Cloud Apps. Changing this forces a new resource to be created.

* `outbound_type` - (Optional) Specifies the egress traffic type of the Spring Cloud Service. Possible values are `loadBalancer` and `userDefinedRouting`. Defaults to `loadBalancer`. Changing this forces a new resource to be created.

* `read_timeout_seconds` - (Optional) Ingress read time out in seconds.

* `service_runtime_network_resource_group` - (Optional) Specifies the Name of the resource group containing network resources of Azure Spring Cloud Service Runtime. Changing this forces a new resource to be created.
Expand Down
Loading