From 348f48a9510dc1a497b0d7fb53f5c3c94d6bbc7b Mon Sep 17 00:00:00 2001 From: Tom Bamford Date: Wed, 15 May 2024 16:46:36 +0100 Subject: [PATCH] fix import checks --- .../authorization/pim_active_role_assignment_resource.go | 6 +++++- .../authorization/pim_eligible_role_assignment_resource.go | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/internal/services/authorization/pim_active_role_assignment_resource.go b/internal/services/authorization/pim_active_role_assignment_resource.go index a96349c48d4fe..57dc9845e8bb9 100644 --- a/internal/services/authorization/pim_active_role_assignment_resource.go +++ b/internal/services/authorization/pim_active_role_assignment_resource.go @@ -228,7 +228,11 @@ func (r PimActiveRoleAssignmentResource) Create() sdk.ResourceFunc { id := parse.NewPimRoleAssignmentID(config.Scope, config.RoleDefinitionId, config.PrincipalId) - if schedule, err := findRoleAssignmentSchedule(ctx, schedulesClient, id); err != nil && schedule != nil { + schedule, err := findRoleAssignmentSchedule(ctx, schedulesClient, id) + if err != nil { + return err + } + if schedule != nil { return metadata.ResourceRequiresImport(r.ResourceType(), id) } diff --git a/internal/services/authorization/pim_eligible_role_assignment_resource.go b/internal/services/authorization/pim_eligible_role_assignment_resource.go index daf4c3c6cf5bf..b709a45355343 100644 --- a/internal/services/authorization/pim_eligible_role_assignment_resource.go +++ b/internal/services/authorization/pim_eligible_role_assignment_resource.go @@ -229,7 +229,11 @@ func (r PimEligibleRoleAssignmentResource) Create() sdk.ResourceFunc { id := parse.NewPimRoleAssignmentID(config.Scope, config.RoleDefinitionId, config.PrincipalId) - if schedule, err := findRoleEligibilitySchedule(ctx, schedulesClient, id); err != nil && schedule != nil { + schedule, err := findRoleEligibilitySchedule(ctx, schedulesClient, id) + if err != nil { + return err + } + if schedule != nil { return metadata.ResourceRequiresImport(r.ResourceType(), id) }