Skip to content

Commit

Permalink
appservice: conditionally rewriting the value for `virtual_network_su…
Browse files Browse the repository at this point in the history
…bnet_id`

This fixes #25832 by ensuring that the Subnet ID is recased
meaning that it'll be in the correct format.

From our side since we're validating the user input for this field, it's hard for us to write a test-case for this one since
it'd be caught by the validation - but this is caused by user input for this field (provisioned through an ARM Template etc)
providing this value without the prefix '/', which the API should be requiring (but isn't).
  • Loading branch information
tombuildsstuff committed May 7, 2024
1 parent f00ef46 commit 627b916
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion internal/services/appservice/linux_web_app_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,12 @@ func (r LinuxWebAppResource) Read() sdk.ResourceFunc {
}

if subnetId := pointer.From(props.VirtualNetworkSubnetId); subnetId != "" {
state.VirtualNetworkSubnetID = subnetId
// some users have provisioned these without a prefixed `/` - as such we need to normalize these
parsed, err := commonids.ParseSubnetIDInsensitively(subnetId)
if err != nil {
return err
}
state.VirtualNetworkSubnetID = parsed.ID()
}
}

Expand Down
7 changes: 6 additions & 1 deletion internal/services/appservice/windows_web_app_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,12 @@ func (r WindowsWebAppResource) Read() sdk.ResourceFunc {
}

if subnetId := pointer.From(props.VirtualNetworkSubnetId); subnetId != "" {
state.VirtualNetworkSubnetID = subnetId
// some users have provisioned these without a prefixed `/` - as such we need to normalize these
parsed, err := commonids.ParseSubnetIDInsensitively(subnetId)
if err != nil {
return err
}
state.VirtualNetworkSubnetID = parsed.ID()
}

state.PublishingFTPBasicAuthEnabled = basicAuthFTP
Expand Down

0 comments on commit 627b916

Please sign in to comment.