From 95115753f923697b47eb4910eaa487e9606f60aa Mon Sep 17 00:00:00 2001 From: Jack Batzner Date: Mon, 23 Dec 2019 14:12:12 -0600 Subject: [PATCH] Fix panic in 'azurerm_api_management_operation' --- azurerm/resource_arm_api_management_api_operation.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/azurerm/resource_arm_api_management_api_operation.go b/azurerm/resource_arm_api_management_api_operation.go index c2d632de09e98..c415d5fb59521 100644 --- a/azurerm/resource_arm_api_management_api_operation.go +++ b/azurerm/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, fmt.Errorf("Error mapping input") + } description := vs["description"].(string) headersRaw := vs["header"].([]interface{}) + if headersRaw == nil { + return nil, fmt.Errorf("Error mapping `header`") + } headers := azure.ExpandApiManagementOperationParameterContract(headersRaw) queryParametersRaw := vs["query_parameter"].([]interface{}) + if queryParametersRaw == nil { + return nil, fmt.Errorf("Error mapping `query_parameter`") + } queryParameters := azure.ExpandApiManagementOperationParameterContract(queryParametersRaw) representationsRaw := vs["representation"].([]interface{}) + if representationsRaw == nil { + return nil, fmt.Errorf("Error mapping `representation`") + } representations, err := azure.ExpandApiManagementOperationRepresentation(representationsRaw) if err != nil { return nil, err