From 6e1ef8abe86d3bb1a2ad6fa1b6f2384379cf5533 Mon Sep 17 00:00:00 2001 From: Dapeng Zhang Date: Thu, 26 Mar 2020 17:52:05 +0800 Subject: [PATCH] Make metadata Computed to avoid some unexpected diff --- .../policy/resource_arm_policy_set_definition.go | 1 + .../tests/resource_arm_policy_set_definition_test.go | 12 ++---------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/azurerm/internal/services/policy/resource_arm_policy_set_definition.go b/azurerm/internal/services/policy/resource_arm_policy_set_definition.go index 2857805640de..a979f32d31fc 100644 --- a/azurerm/internal/services/policy/resource_arm_policy_set_definition.go +++ b/azurerm/internal/services/policy/resource_arm_policy_set_definition.go @@ -79,6 +79,7 @@ func resourceArmPolicySetDefinition() *schema.Resource { "metadata": { Type: schema.TypeString, Optional: true, + Computed: true, ValidateFunc: validation.StringIsJSON, DiffSuppressFunc: structure.SuppressJsonDiff, }, diff --git a/azurerm/internal/services/policy/tests/resource_arm_policy_set_definition_test.go b/azurerm/internal/services/policy/tests/resource_arm_policy_set_definition_test.go index d3b31ab3aecf..3a233cd19069 100644 --- a/azurerm/internal/services/policy/tests/resource_arm_policy_set_definition_test.go +++ b/azurerm/internal/services/policy/tests/resource_arm_policy_set_definition_test.go @@ -5,14 +5,11 @@ import ( "testing" "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/policy" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/acceptance" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients" - "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/features" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" - - "github.com/hashicorp/terraform-plugin-sdk/terraform" - - "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func TestAccAzureRMPolicySetDefinition_builtIn(t *testing.T) { @@ -34,11 +31,6 @@ func TestAccAzureRMPolicySetDefinition_builtIn(t *testing.T) { } func TestAccAzureRMPolicySetDefinition_requiresImport(t *testing.T) { - if !features.ShouldResourcesBeImported() { - t.Skip("Skipping since resources aren't required to be imported") - return - } - data := acceptance.BuildTestData(t, "azurerm_policy_set_definition", "test") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acceptance.PreCheck(t) },