Skip to content

Commit

Permalink
Merge pull request #22596 from ms-henglu/issue-21500-spring-cloud-out…
Browse files Browse the repository at this point in the history
…bound-type

`azurerm_spring_cloud_service` - support for `outbound_type` property
  • Loading branch information
manicminer committed Jul 19, 2023
2 parents 1feedb2 + d485a43 commit 51824cb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
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

0 comments on commit 51824cb

Please sign in to comment.