From 4e9744ba8a64ac62337dae53a6bc429cbb49b27f Mon Sep 17 00:00:00 2001 From: Tom Bamford Date: Thu, 4 Jun 2020 21:58:59 +0100 Subject: [PATCH] Cater for nil OptionalClaims in Application --- azuread/resource_application.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/azuread/resource_application.go b/azuread/resource_application.go index 8f6822311a..4eccd26549 100644 --- a/azuread/resource_application.go +++ b/azuread/resource_application.go @@ -745,6 +745,12 @@ func expandADApplicationOptionalClaim(in []interface{}) *[]graphrbac.OptionalCla } func flattenADApplicationOptionalClaims(in *graphrbac.OptionalClaims) interface{} { + var result []map[string]interface{} + + if in == nil { + return result + } + optionalClaims := make(map[string]interface{}) if claims := flattenADApplicationOptionalClaimsList(in.AccessToken); len(claims) > 0 { optionalClaims["access_token"] = claims @@ -756,7 +762,6 @@ func flattenADApplicationOptionalClaims(in *graphrbac.OptionalClaims) interface{ //if claims := flattenADApplicationOptionalClaimsList(in.SamlToken); len(claims) > 0 { // optionalClaims["saml_token"] = claims //} - var result []map[string]interface{} if len(optionalClaims) == 0 { return result }