From c7fa51266ed6bdc727ab2d31c2b901937ddf0c74 Mon Sep 17 00:00:00 2001 From: Jack Date: Mon, 30 Dec 2019 17:29:19 -0600 Subject: [PATCH] Fix panic in 'azurerm_api_management_operation' (#5273) Fix panic in 'azurerm_api_management_operation' Recreatd #5243 after the changes to the provider organization. --- .../resource_arm_api_management_api_operation.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/azurerm/internal/services/apimanagement/resource_arm_api_management_api_operation.go b/azurerm/internal/services/apimanagement/resource_arm_api_management_api_operation.go index 38e7bbd2daaf..da9c713c8d58 100644 --- a/azurerm/internal/services/apimanagement/resource_arm_api_management_api_operation.go +++ b/azurerm/internal/services/apimanagement/resource_arm_api_management_api_operation.go @@ -250,15 +250,27 @@ func expandApiManagementOperationRequestContract(input []interface{}) (*apimanag } vs := input[0].(map[string]interface{}) + if vs == nil { + return nil, nil + } description := vs["description"].(string) headersRaw := vs["header"].([]interface{}) + if headersRaw == nil { + headersRaw = []interface{}{} + } headers := azure.ExpandApiManagementOperationParameterContract(headersRaw) queryParametersRaw := vs["query_parameter"].([]interface{}) + if queryParametersRaw == nil { + queryParametersRaw = []interface{}{} + } queryParameters := azure.ExpandApiManagementOperationParameterContract(queryParametersRaw) representationsRaw := vs["representation"].([]interface{}) + if representationsRaw == nil { + representationsRaw = []interface{}{} + } representations, err := azure.ExpandApiManagementOperationRepresentation(representationsRaw) if err != nil { return nil, err