diff --git a/ibm/service/partnercentersell/resource_ibm_onboarding_catalog_deployment.go b/ibm/service/partnercentersell/resource_ibm_onboarding_catalog_deployment.go index 3d2010e253..d885b25af1 100644 --- a/ibm/service/partnercentersell/resource_ibm_onboarding_catalog_deployment.go +++ b/ibm/service/partnercentersell/resource_ibm_onboarding_catalog_deployment.go @@ -850,7 +850,7 @@ func ResourceIbmOnboardingCatalogDeploymentMapToGlobalCatalogDeploymentMetadata( } model.Service = ServiceModel } - if modelMap["deployment"] != nil && len(modelMap["deployment"].([]interface{})) > 0 { + if modelMap["deployment"] != nil && len(modelMap["deployment"].([]interface{})) > 0 && modelMap["deployment"].([]interface{})[0] != nil { DeploymentModel, err := ResourceIbmOnboardingCatalogDeploymentMapToGlobalCatalogMetadataDeployment(modelMap["deployment"].([]interface{})[0].(map[string]interface{})) if err != nil { return model, err @@ -1021,7 +1021,7 @@ func ResourceIbmOnboardingCatalogDeploymentMapToGlobalCatalogMetadataService(mod func ResourceIbmOnboardingCatalogDeploymentMapToGlobalCatalogMetadataDeployment(modelMap map[string]interface{}) (*partnercentersellv1.GlobalCatalogMetadataDeployment, error) { model := &partnercentersellv1.GlobalCatalogMetadataDeployment{} - if modelMap["broker"] != nil && len(modelMap["broker"].([]interface{})) > 0 { + if modelMap["broker"] != nil && len(modelMap["broker"].([]interface{})) > 0 && modelMap["broker"].([]interface{})[0] != nil { BrokerModel, err := ResourceIbmOnboardingCatalogDeploymentMapToGlobalCatalogMetadataDeploymentBroker(modelMap["broker"].([]interface{})[0].(map[string]interface{})) if err != nil { return model, err @@ -1507,13 +1507,13 @@ func ResourceIbmOnboardingCatalogDeploymentGlobalCatalogMetadataUIStringsContent if _, exists := d.GetOk(path); d.HasChange(path) && !exists { patch["bullets"] = nil } else if exists && patch["bullets"] != nil { - ResourceIbmOnboardingCatalogDeploymentCatalogHighlightItemAsPatch(patch["bullets"].([]interface{})[0].(map[string]interface{}), d) + ResourceIbmOnboardingCatalogDeploymentCatalogHighlightItemAsPatch(patch["bullets"].([]map[string]interface{})[0], d) } path = "metadata.0.ui.0.strings.0.en.0.media" if _, exists := d.GetOk(path); d.HasChange(path) && !exists { patch["media"] = nil } else if exists && patch["media"] != nil { - ResourceIbmOnboardingCatalogDeploymentCatalogProductMediaItemAsPatch(patch["media"].([]interface{})[0].(map[string]interface{}), d) + ResourceIbmOnboardingCatalogDeploymentCatalogProductMediaItemAsPatch(patch["media"].([]map[string]interface{})[0], d) } path = "metadata.0.ui.0.strings.0.en.0.embeddable_dashboard" if _, exists := d.GetOk(path); d.HasChange(path) && !exists { diff --git a/ibm/service/partnercentersell/resource_ibm_onboarding_catalog_plan.go b/ibm/service/partnercentersell/resource_ibm_onboarding_catalog_plan.go index 1022637589..334e9bd7b4 100644 --- a/ibm/service/partnercentersell/resource_ibm_onboarding_catalog_plan.go +++ b/ibm/service/partnercentersell/resource_ibm_onboarding_catalog_plan.go @@ -818,7 +818,7 @@ func ResourceIbmOnboardingCatalogPlanMapToGlobalCatalogPlanMetadata(modelMap map } model.Pricing = PricingModel } - if modelMap["plan"] != nil && len(modelMap["plan"].([]interface{})) > 0 { + if modelMap["plan"] != nil && len(modelMap["plan"].([]interface{})) > 0 && modelMap["plan"].([]interface{})[0] != nil { PlanModel, err := ResourceIbmOnboardingCatalogPlanMapToGlobalCatalogPlanMetadataPlan(modelMap["plan"].([]interface{})[0].(map[string]interface{})) if err != nil { return model, err @@ -1458,13 +1458,13 @@ func ResourceIbmOnboardingCatalogPlanGlobalCatalogMetadataUIStringsContentAsPatc if _, exists := d.GetOk(path); d.HasChange(path) && !exists { patch["bullets"] = nil } else if exists && patch["bullets"] != nil { - ResourceIbmOnboardingCatalogPlanCatalogHighlightItemAsPatch(patch["bullets"].([]interface{})[0].(map[string]interface{}), d) + ResourceIbmOnboardingCatalogPlanCatalogHighlightItemAsPatch(patch["bullets"].([]map[string]interface{})[0], d) } path = "metadata.0.ui.0.strings.0.en.0.media" if _, exists := d.GetOk(path); d.HasChange(path) && !exists { patch["media"] = nil } else if exists && patch["media"] != nil { - ResourceIbmOnboardingCatalogPlanCatalogProductMediaItemAsPatch(patch["media"].([]interface{})[0].(map[string]interface{}), d) + ResourceIbmOnboardingCatalogPlanCatalogProductMediaItemAsPatch(patch["media"].([]map[string]interface{})[0], d) } path = "metadata.0.ui.0.strings.0.en.0.embeddable_dashboard" if _, exists := d.GetOk(path); d.HasChange(path) && !exists { diff --git a/ibm/service/partnercentersell/resource_ibm_onboarding_catalog_product.go b/ibm/service/partnercentersell/resource_ibm_onboarding_catalog_product.go index d2ab30c696..4f816e1fbd 100644 --- a/ibm/service/partnercentersell/resource_ibm_onboarding_catalog_product.go +++ b/ibm/service/partnercentersell/resource_ibm_onboarding_catalog_product.go @@ -1210,7 +1210,7 @@ func ResourceIbmOnboardingCatalogProductMapToGlobalCatalogProductMetadataOther(m } model.PC = PCModel } - if modelMap["composite"] != nil && len(modelMap["composite"].([]interface{})) > 0 { + if modelMap["composite"] != nil && len(modelMap["composite"].([]interface{})) > 0 && modelMap["composite"].([]interface{})[0] != nil { CompositeModel, err := ResourceIbmOnboardingCatalogProductMapToGlobalCatalogProductMetadataOtherComposite(modelMap["composite"].([]interface{})[0].(map[string]interface{})) if err != nil { return model, err @@ -1955,7 +1955,7 @@ func ResourceIbmOnboardingCatalogProductGlobalCatalogProductMetadataOtherComposi if _, exists := d.GetOk(path); d.HasChange(path) && !exists { patch["children"] = nil } else if exists && patch["children"] != nil { - ResourceIbmOnboardingCatalogProductGlobalCatalogProductMetadataOtherCompositeChildAsPatch(patch["children"].([]interface{})[0].(map[string]interface{}), d) + ResourceIbmOnboardingCatalogProductGlobalCatalogProductMetadataOtherCompositeChildAsPatch(patch["children"].([]map[string]interface{})[0], d) } } @@ -2024,7 +2024,7 @@ func ResourceIbmOnboardingCatalogProductGlobalCatalogProductMetadataOtherPCSuppo if _, exists := d.GetOk(path); d.HasChange(path) && !exists { patch["support_details"] = nil } else if exists && patch["support_details"] != nil { - ResourceIbmOnboardingCatalogProductSupportDetailsItemAsPatch(patch["support_details"].([]interface{})[0].(map[string]interface{}), d) + ResourceIbmOnboardingCatalogProductSupportDetailsItemAsPatch(patch["support_details"].([]map[string]interface{})[0], d) } } @@ -2060,7 +2060,7 @@ func ResourceIbmOnboardingCatalogProductSupportDetailsItemAvailabilityAsPatch(pa if _, exists := d.GetOk(path); d.HasChange(path) && !exists { patch["times"] = nil } else if exists && patch["times"] != nil { - ResourceIbmOnboardingCatalogProductSupportDetailsItemAvailabilityTimeAsPatch(patch["times"].([]interface{})[0].(map[string]interface{}), d) + ResourceIbmOnboardingCatalogProductSupportDetailsItemAvailabilityTimeAsPatch(patch["times"].([]map[string]interface{})[0], d) } path = "metadata.0.other.0.pc.0.support.0.support_details.0.availability.0.timezone" if _, exists := d.GetOk(path); d.HasChange(path) && !exists { @@ -2222,13 +2222,13 @@ func ResourceIbmOnboardingCatalogProductGlobalCatalogMetadataUIStringsContentAsP if _, exists := d.GetOk(path); d.HasChange(path) && !exists { patch["bullets"] = nil } else if exists && patch["bullets"] != nil { - ResourceIbmOnboardingCatalogProductCatalogHighlightItemAsPatch(patch["bullets"].([]interface{})[0].(map[string]interface{}), d) + ResourceIbmOnboardingCatalogProductCatalogHighlightItemAsPatch(patch["bullets"].([]map[string]interface{})[0], d) } path = "metadata.0.ui.0.strings.0.en.0.media" if _, exists := d.GetOk(path); d.HasChange(path) && !exists { patch["media"] = nil } else if exists && patch["media"] != nil { - ResourceIbmOnboardingCatalogProductCatalogProductMediaItemAsPatch(patch["media"].([]interface{})[0].(map[string]interface{}), d) + ResourceIbmOnboardingCatalogProductCatalogProductMediaItemAsPatch(patch["media"].([]map[string]interface{})[0], d) } path = "metadata.0.ui.0.strings.0.en.0.embeddable_dashboard" if _, exists := d.GetOk(path); d.HasChange(path) && !exists { diff --git a/ibm/service/partnercentersell/resource_ibm_onboarding_iam_registration.go b/ibm/service/partnercentersell/resource_ibm_onboarding_iam_registration.go index de91f46a22..d7e82eef93 100644 --- a/ibm/service/partnercentersell/resource_ibm_onboarding_iam_registration.go +++ b/ibm/service/partnercentersell/resource_ibm_onboarding_iam_registration.go @@ -2527,7 +2527,7 @@ func ResourceIbmOnboardingIamRegistrationIamServiceRegistrationPatchAsPatch(patc if _, exists := d.GetOk(path); d.HasChange(path) && !exists { patch["actions"] = nil } else if exists && patch["actions"] != nil { - ResourceIbmOnboardingIamRegistrationIamServiceRegistrationActionAsPatch(patch["actions"].([]interface{})[0].(map[string]interface{}), d) + ResourceIbmOnboardingIamRegistrationIamServiceRegistrationActionAsPatch(patch["actions"].([]map[string]interface{})[0], d) } path = "additional_policy_scopes" if _, exists := d.GetOk(path); d.HasChange(path) && !exists { @@ -2551,25 +2551,25 @@ func ResourceIbmOnboardingIamRegistrationIamServiceRegistrationPatchAsPatch(patc if _, exists := d.GetOk(path); d.HasChange(path) && !exists { patch["supported_anonymous_accesses"] = nil } else if exists && patch["supported_anonymous_accesses"] != nil { - ResourceIbmOnboardingIamRegistrationIamServiceRegistrationSupportedAnonymousAccessAsPatch(patch["supported_anonymous_accesses"].([]interface{})[0].(map[string]interface{}), d) + ResourceIbmOnboardingIamRegistrationIamServiceRegistrationSupportedAnonymousAccessAsPatch(patch["supported_anonymous_accesses"].([]map[string]interface{})[0], d) } path = "supported_attributes" if _, exists := d.GetOk(path); d.HasChange(path) && !exists { patch["supported_attributes"] = nil } else if exists && patch["supported_attributes"] != nil { - ResourceIbmOnboardingIamRegistrationIamServiceRegistrationSupportedAttributeAsPatch(patch["supported_attributes"].([]interface{})[0].(map[string]interface{}), d) + ResourceIbmOnboardingIamRegistrationIamServiceRegistrationSupportedAttributeAsPatch(patch["supported_attributes"].([]map[string]interface{})[0], d) } path = "supported_authorization_subjects" if _, exists := d.GetOk(path); d.HasChange(path) && !exists { patch["supported_authorization_subjects"] = nil } else if exists && patch["supported_authorization_subjects"] != nil { - ResourceIbmOnboardingIamRegistrationIamServiceRegistrationSupportedAuthorizationSubjectAsPatch(patch["supported_authorization_subjects"].([]interface{})[0].(map[string]interface{}), d) + ResourceIbmOnboardingIamRegistrationIamServiceRegistrationSupportedAuthorizationSubjectAsPatch(patch["supported_authorization_subjects"].([]map[string]interface{})[0], d) } path = "supported_roles" if _, exists := d.GetOk(path); d.HasChange(path) && !exists { patch["supported_roles"] = nil } else if exists && patch["supported_roles"] != nil { - ResourceIbmOnboardingIamRegistrationIamServiceRegistrationSupportedRoleAsPatch(patch["supported_roles"].([]interface{})[0].(map[string]interface{}), d) + ResourceIbmOnboardingIamRegistrationIamServiceRegistrationSupportedRoleAsPatch(patch["supported_roles"].([]map[string]interface{})[0], d) } path = "supported_network" if _, exists := d.GetOk(path); d.HasChange(path) && !exists { @@ -2588,7 +2588,7 @@ func ResourceIbmOnboardingIamRegistrationIamServiceRegistrationSupportedNetworkA if _, exists := d.GetOk(path); d.HasChange(path) && !exists { patch["environment_attributes"] = nil } else if exists && patch["environment_attributes"] != nil { - ResourceIbmOnboardingIamRegistrationEnvironmentAttributeAsPatch(patch["environment_attributes"].([]interface{})[0].(map[string]interface{}), d) + ResourceIbmOnboardingIamRegistrationEnvironmentAttributeAsPatch(patch["environment_attributes"].([]map[string]interface{})[0], d) } } @@ -2747,7 +2747,7 @@ func ResourceIbmOnboardingIamRegistrationSupportedAttributeUiInputDetailsAsPatch if _, exists := d.GetOk(path); d.HasChange(path) && !exists { patch["values"] = nil } else if exists && patch["values"] != nil { - ResourceIbmOnboardingIamRegistrationSupportedAttributeUiInputValueAsPatch(patch["values"].([]interface{})[0].(map[string]interface{}), d) + ResourceIbmOnboardingIamRegistrationSupportedAttributeUiInputValueAsPatch(patch["values"].([]map[string]interface{})[0], d) } path = "supported_attributes.0.ui.0.input_details.0.gst" if _, exists := d.GetOk(path); d.HasChange(path) && !exists { diff --git a/ibm/service/partnercentersell/resource_ibm_onboarding_iam_registration_test.go b/ibm/service/partnercentersell/resource_ibm_onboarding_iam_registration_test.go index fc61170ff1..beb4091ca8 100644 --- a/ibm/service/partnercentersell/resource_ibm_onboarding_iam_registration_test.go +++ b/ibm/service/partnercentersell/resource_ibm_onboarding_iam_registration_test.go @@ -51,6 +51,7 @@ func TestAccIbmOnboardingIamRegistrationAllArgs(t *testing.T) { enabled := "true" serviceType := "platform_service" envUpdate := "current" + roleDisplayNameUpdate := fmt.Sprintf("random-%d", acctest.RandIntRange(10, 100)) nameUpdate := acc.PcsIamServiceRegistrationId enabledUpdate := "true" serviceTypeUpdate := "service" @@ -72,7 +73,7 @@ func TestAccIbmOnboardingIamRegistrationAllArgs(t *testing.T) { ), }, resource.TestStep{ - Config: testAccCheckIbmOnboardingIamRegistrationConfig(productID, envUpdate, nameUpdate, enabledUpdate, serviceTypeUpdate, iamRegistrationRole, roleDisplayName, acc.PcsIamServiceRegistrationId), + Config: testAccCheckIbmOnboardingIamRegistrationConfig(productID, envUpdate, nameUpdate, enabledUpdate, serviceTypeUpdate, iamRegistrationRole, roleDisplayNameUpdate, acc.PcsIamServiceRegistrationId), Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr("ibm_onboarding_iam_registration.onboarding_iam_registration_instance", "product_id", productID), resource.TestCheckResourceAttr("ibm_onboarding_iam_registration.onboarding_iam_registration_instance", "env", envUpdate), diff --git a/ibm/service/partnercentersell/resource_ibm_onboarding_product.go b/ibm/service/partnercentersell/resource_ibm_onboarding_product.go index 9477675ef2..5ae93ee55f 100644 --- a/ibm/service/partnercentersell/resource_ibm_onboarding_product.go +++ b/ibm/service/partnercentersell/resource_ibm_onboarding_product.go @@ -538,7 +538,7 @@ func ResourceIbmOnboardingProductOnboardingProductSupportAsPatch(patch map[strin if _, exists := d.GetOk(path); d.HasChange(path) && !exists { patch["escalation_contacts"] = nil } else if exists && patch["escalation_contacts"] != nil { - ResourceIbmOnboardingProductOnboardingProductSupportEscalationContactItemsAsPatch(patch["escalation_contacts"].([]interface{})[0].(map[string]interface{}), d) + ResourceIbmOnboardingProductOnboardingProductSupportEscalationContactItemsAsPatch(patch["escalation_contacts"].([]map[string]interface{})[0], d) } }