diff --git a/internal/services/network/application_gateway_resource.go b/internal/services/network/application_gateway_resource.go index f2443a188c37..0003f0247c88 100644 --- a/internal/services/network/application_gateway_resource.go +++ b/internal/services/network/application_gateway_resource.go @@ -3848,6 +3848,7 @@ func flattenApplicationGatewayRewriteRuleSets(input *[]network.ApplicationGatewa if actionSet.URLConfiguration != nil { config := *actionSet.URLConfiguration components := "" + path := "" if config.ModifiedPath != nil { path = *config.ModifiedPath @@ -3858,12 +3859,17 @@ func flattenApplicationGatewayRewriteRuleSets(input *[]network.ApplicationGatewa queryString = *config.ModifiedQueryString } - if path != queryString { - if path != "" && queryString == "" { - components = "path_only" - } else if queryString != "" && path == "" { - components = "query_string_only" - } + // `components` doesn't exist in the API - it appears to be purely a UI state in the Portal + // as such we should consider removing this field in the future. + if path == queryString { + // used to represent `both` + components = "" + } + if config.ModifiedQueryString != nil && config.ModifiedPath == nil { + components = "query_string_only" + } + if config.ModifiedQueryString == nil && config.ModifiedPath != nil { + components = "path_only" } reroute := false