From 3f2a39a05a091917553a15833566a1ce0386db6e Mon Sep 17 00:00:00 2001 From: Gabriel Nepomuceno Date: Sat, 10 Sep 2022 11:20:44 +0100 Subject: [PATCH] Reverse the order of policies lookup to favour builtin --- internal/services/policy/policy.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/services/policy/policy.go b/internal/services/policy/policy.go index 71d7963227ba..de51556ac519 100644 --- a/internal/services/policy/policy.go +++ b/internal/services/policy/policy.go @@ -50,9 +50,9 @@ func getPolicyDefinitionByDisplayName(ctx context.Context, client *policy.Defini func getPolicyDefinitionByName(ctx context.Context, client *policy.DefinitionsClient, name, managementGroupName string) (res policy.Definition, err error) { if managementGroupName == "" { - res, err = client.Get(ctx, name) + res, err = client.GetBuiltIn(ctx, name) if utils.ResponseWasNotFound(res.Response) { - res, err = client.GetBuiltIn(ctx, name) + res, err = client.Get(ctx, name) } } else { res, err = client.GetAtManagementGroup(ctx, name, managementGroupName) @@ -63,9 +63,9 @@ func getPolicyDefinitionByName(ctx context.Context, client *policy.DefinitionsCl func getPolicySetDefinitionByName(ctx context.Context, client *policy.SetDefinitionsClient, name, managementGroupID string) (res policy.SetDefinition, err error) { if managementGroupID == "" { - res, err = client.Get(ctx, name) + res, err = client.GetBuiltIn(ctx, name) if utils.ResponseWasNotFound(res.Response) { - res, err = client.GetBuiltIn(ctx, name) + res, err = client.Get(ctx, name) } } else { res, err = client.GetAtManagementGroup(ctx, name, managementGroupID)