Skip to content

Commit

Permalink
add missing ignore_changes (hashicorp#26756)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephybun authored Jul 24, 2024
1 parent ad5845f commit 46e656b
Show file tree
Hide file tree
Showing 27 changed files with 72 additions and 82 deletions.
2 changes: 2 additions & 0 deletions internal/services/compute/image_data_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ resource "azurerm_public_ip" "test" {
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
allocation_method = "Dynamic"
sku = "Basic"
domain_name_label = "acctestpip%d"
}
Expand Down Expand Up @@ -223,6 +224,7 @@ resource "azurerm_public_ip" "test" {
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
allocation_method = "Dynamic"
sku = "Basic"
domain_name_label = "acctestpip%d"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,7 @@ resource "azurerm_public_ip" "test" {
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
allocation_method = %q
sku = "Basic"
}
resource "azurerm_network_interface" "test" {
Expand All @@ -924,6 +925,7 @@ resource "azurerm_public_ip" "test" {
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
allocation_method = %q
sku = "Basic"
}
resource "azurerm_network_interface" "test" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ resource "azurerm_public_ip" "source" {
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
allocation_method = "Dynamic"
sku = "Basic"
}
resource "azurerm_network_interface" "source" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,7 @@ resource "azurerm_public_ip" "test" {
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
allocation_method = "Dynamic"
sku = "Basic"
}
# since these variables are re-used - a locals block makes this more maintainable
Expand Down Expand Up @@ -1746,8 +1747,6 @@ resource "azurerm_public_ip" "test" {
resource_group_name = azurerm_resource_group.test.name
allocation_method = "Static"
domain_name_label = "acctest-%[3]s"
sku = "Standard"
}
resource "azurerm_lb" "test" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2332,6 +2332,7 @@ resource "azurerm_public_ip" "test" {
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
allocation_method = "Dynamic"
sku = "Basic"
idle_timeout_in_minutes = 4
}
Expand Down Expand Up @@ -2444,6 +2445,7 @@ resource "azurerm_public_ip" "test" {
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
allocation_method = "Dynamic"
sku = "Basic"
idle_timeout_in_minutes = 4
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1968,6 +1968,7 @@ resource "azurerm_public_ip" "gwtest" {
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
allocation_method = "Dynamic"
sku = "Basic"
}
resource "azurerm_application_gateway" "test" {
Expand Down Expand Up @@ -2056,7 +2057,6 @@ resource "azurerm_public_ip" "test" {
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
allocation_method = "Static"
sku = "Standard"
}
resource "azurerm_virtual_network" "test" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,7 @@ resource "azurerm_public_ip" "test" {
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
allocation_method = %q
sku = "Basic"
}
resource "azurerm_network_interface" "test" {
Expand All @@ -868,6 +869,7 @@ resource "azurerm_public_ip" "test" {
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
allocation_method = %q
sku = "Basic"
}
resource "azurerm_network_interface" "test" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ resource "azurerm_public_ip" "source" {
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
allocation_method = "Dynamic"
sku = "Basic"
}
resource "azurerm_network_interface" "source" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ resource "azurerm_public_ip" "test" {
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
allocation_method = "Dynamic"
sku = "Basic"
}
# since these variables are re-used - a locals block makes this more maintainable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2721,6 +2721,7 @@ resource "azurerm_public_ip" "test" {
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
allocation_method = "Dynamic"
sku = "Basic"
idle_timeout_in_minutes = 4
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,6 @@ resource "azurerm_kubernetes_cluster" "test" {
azure_active_directory_role_based_access_control {
tenant_id = var.tenant_id
managed = true
azure_rbac_enabled = false
}
}
Expand Down Expand Up @@ -890,7 +889,6 @@ resource "azurerm_kubernetes_cluster" "test" {
azure_active_directory_role_based_access_control {
tenant_id = var.tenant_id
managed = true
azure_rbac_enabled = false
}
}
Expand Down Expand Up @@ -938,7 +936,6 @@ resource "azurerm_kubernetes_cluster" "test" {
azure_active_directory_role_based_access_control {
tenant_id = var.tenant_id
managed = true
azure_rbac_enabled = false
}
}
Expand Down Expand Up @@ -1079,7 +1076,6 @@ resource "azurerm_kubernetes_cluster" "test" {
azure_active_directory_role_based_access_control {
tenant_id = var.tenant_id
managed = true
azure_rbac_enabled = true
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1677,7 +1677,7 @@ resource "azurerm_kubernetes_cluster" "test" {
network_profile {
network_plugin = "azure"
ebpf_data_plane = "cilium"
network_data_plane = "cilium"
network_plugin_mode = "overlay"
}
}
Expand Down Expand Up @@ -1736,7 +1736,7 @@ resource "azurerm_kubernetes_cluster" "test" {
network_profile {
network_plugin = "azure"
network_policy = "cilium"
ebpf_data_plane = "cilium"
network_data_plane = "cilium"
network_plugin_mode = "overlay"
}
}
Expand Down Expand Up @@ -4237,7 +4237,7 @@ resource "azurerm_kubernetes_cluster" "test" {
pod_cidr = "192.168.0.0/16"
network_plugin = "azure"
ebpf_data_plane = "cilium"
network_data_plane = "cilium"
network_plugin_mode = "overlay"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ resource "azurerm_subnet" "test" {
virtual_network_name = azurerm_virtual_network.test.name
address_prefixes = ["10.0.2.0/24"]
private_endpoint_network_policies = "Enabled"
private_link_service_network_policies_enabled = true
private_link_service_network_policies_enabled = false
}
resource "azurerm_public_ip" "test" {
Expand Down
10 changes: 0 additions & 10 deletions internal/services/devtestlabs/dev_test_lab_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,6 @@ func resourceDevTestLab() *pluginsdk.Resource {
// BUG: https://github.com/Azure/azure-rest-api-specs/issues/3964
"resource_group_name": azure.SchemaResourceGroupNameDiffSuppress(),

"storage_type": {
Type: pluginsdk.TypeString,
Optional: true,
Default: string(labs.StorageTypePremium),
ValidateFunc: validation.StringInSlice([]string{
string(labs.StorageTypeStandard),
string(labs.StorageTypePremium),
}, false),
},

"tags": tags.Schema(),

"artifacts_storage_account_id": {
Expand Down
5 changes: 0 additions & 5 deletions internal/services/devtestlabs/dev_test_lab_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ func TestAccDevTestLab_basic(t *testing.T) {
Config: r.basic(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("storage_type").HasValue("Premium"),
check.That(data.ResourceName).Key("tags.%").HasValue("0"),
),
},
data.ImportStep(),
Expand Down Expand Up @@ -62,9 +60,6 @@ func TestAccDevTestLab_complete(t *testing.T) {
Config: r.complete(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("storage_type").HasValue("Standard"),
check.That(data.ResourceName).Key("tags.%").HasValue("1"),
check.That(data.ResourceName).Key("tags.Hello").HasValue("World"),
),
},
data.ImportStep(),
Expand Down
1 change: 0 additions & 1 deletion internal/services/eventhub/eventhub_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,6 @@ resource "azurerm_eventhub_namespace" "test" {
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
sku = "Premium"
zone_redundant = true
}
resource "azurerm_eventhub" "test" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ resource "azurerm_virtual_network" "test" {
address_space = ["10.0.0.0/16"]
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
lifecycle {
ignore_changes = [subnet]
}
}
resource "azurerm_subnet" "test" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,7 @@ resource "azurerm_key_vault" "test" {
soft_delete_retention_days = 7
lifecycle {
ignore_changes = [
contact
]
ignore_changes = [contact, access_policy]
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1345,6 +1345,10 @@ resource "azurerm_key_vault" "test" {
tenant_id = data.azurerm_client_config.current.tenant_id
sku_name = "standard"
soft_delete_retention_days = 7
lifecycle {
ignore_changes = [access_policy]
}
}
resource "azurerm_key_vault_access_policy" "test" {
Expand Down Expand Up @@ -1443,6 +1447,10 @@ resource "azurerm_key_vault" "test" {
tenant_id = data.azurerm_client_config.current.tenant_id
sku_name = "standard"
soft_delete_retention_days = 7
lifecycle {
ignore_changes = [access_policy]
}
}
resource "azurerm_key_vault_access_policy" "test" {
Expand Down
8 changes: 8 additions & 0 deletions internal/services/keyvault/key_vault_key_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,10 @@ resource "azurerm_key_vault" "test" {
tags = {
environment = "accTest"
}
lifecycle {
ignore_changes = [access_policy]
}
}
resource "azurerm_key_vault_access_policy" "test" {
Expand Down Expand Up @@ -839,6 +843,10 @@ resource "azurerm_key_vault" "test" {
tags = {
environment = "accTest"
}
lifecycle {
ignore_changes = [access_policy]
}
}
resource "azurerm_key_vault_access_policy" "test" {
Expand Down
54 changes: 4 additions & 50 deletions internal/services/keyvault/key_vault_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,29 +462,6 @@ func TestAccKeyVault_purgeProtectionAttemptToDisable(t *testing.T) {
})
}

func TestAccKeyVault_deletePolicy(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_key_vault", "test")
r := KeyVaultResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.basic(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep(),
{
Config: r.noPolicy(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("access_policy.#").HasValue("0"),
),
},
data.ImportStep(),
})
}

func (KeyVaultResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) {
id, err := commonids.ParseKeyVaultID(state.ID)
if err != nil {
Expand Down Expand Up @@ -644,6 +621,10 @@ resource "azurerm_virtual_network" "test" {
address_space = ["10.0.0.0/16"]
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
lifecycle {
ignore_changes = [subnet]
}
}
resource "azurerm_subnet" "test_a" {
Expand Down Expand Up @@ -1169,33 +1150,6 @@ resource "azurerm_key_vault" "test" {
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger)
}

func (KeyVaultResource) noPolicy(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
}
data "azurerm_client_config" "current" {
}
resource "azurerm_resource_group" "test" {
name = "acctestRG-%d"
location = "%s"
}
resource "azurerm_key_vault" "test" {
name = "vault%d"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
tenant_id = data.azurerm_client_config.current.tenant_id
sku_name = "standard"
soft_delete_retention_days = 7
access_policy = []
}
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger)
}

// TODO: Remove in 4.0
func (KeyVaultResource) updateContacts(data acceptance.TestData) string {
return fmt.Sprintf(`
Expand Down
Loading

0 comments on commit 46e656b

Please sign in to comment.