diff --git a/resource/context_test.go b/resource/context_test.go index f76e6bd..84a364d 100644 --- a/resource/context_test.go +++ b/resource/context_test.go @@ -17,6 +17,19 @@ func Test_NewContextInit(t *testing.T) { } } +provider "azurerm" { + features { + resource_group { + prevent_deletion_if_contains_resources = false + } + key_vault { + purge_soft_delete_on_destroy = false + purge_soft_deleted_keys_on_destroy = false + } + } + skip_provider_registration = true +} + provider "azapi" { skip_provider_registration = false } diff --git a/tf/utils.go b/tf/utils.go index da8ebfc..b1c40d7 100644 --- a/tf/utils.go +++ b/tf/utils.go @@ -84,7 +84,7 @@ func NewDiffReport(plan *tfjson.Plan, logs []paltypes.RequestTrace) types.DiffRe continue } - change := types.Change{} + var change types.Change if _, ok := beforeMap["body"].(string); ok { change = types.Change{ @@ -332,7 +332,7 @@ func NewErrorReport(applyErr error, logs []paltypes.RequestTrace) types.ErrorRep if applyErr == nil { return out } - res := make([]string, 0) + var res []string if strings.Contains(applyErr.Error(), "Error: Failed to create/update resource") { res = strings.Split(applyErr.Error(), "Error: Failed to create/update resource") } else { @@ -372,7 +372,7 @@ func NewCleanupErrorReport(applyErr error, logs []paltypes.RequestTrace) types.E if applyErr == nil { return out } - res := make([]string, 0) + var res []string if strings.Contains(applyErr.Error(), "Error: Failed to delete resource") { res = strings.Split(applyErr.Error(), "Error: Failed to delete resource") } else {