From db3dc93484e2b6e7e02e5c7eda76d2d8be0f9bda Mon Sep 17 00:00:00 2001 From: henglu Date: Mon, 21 Mar 2022 14:46:54 +0800 Subject: [PATCH 1/2] fix failed testcases in Synapse --- .../synapse_firewall_rule_resource_test.go | 3 + ...integration_runtime_azure_resource_test.go | 3 + ...ation_runtime_self_hosted_resource_test.go | 3 + .../synapse_linked_service_resource_test.go | 3 + ..._managed_private_endpoint_resource_test.go | 3 + .../synapse_role_assignment_resource_test.go | 3 + .../synapse_spark_pool_resource_test.go | 3 + ..._extended_auditing_policy_resource_test.go | 3 + .../synapse/synapse_sql_pool_resource_test.go | 3 + ...ool_security_alert_policy_resource_test.go | 3 + ...ility_assessment_baseline_resource_test.go | 3 + ..._vulnerability_assessment_resource_test.go | 3 + ..._pool_workload_classifier_resource_test.go | 3 + ...e_sql_pool_workload_group_resource_test.go | 3 + ...napse_workspace_aad_admin_resource_test.go | 4 + ..._extended_auditing_policy_resource_test.go | 3 + .../synapse_workspace_key_resource_test.go | 4 +- .../synapse_workspace_resource_test.go | 85 ++++++++++++++++--- ...ace_security_alert_policy_resource_test.go | 3 + ...e_workspace_sql_aad_admin_resource_test.go | 3 + ..._vulnerability_assessment_resource_test.go | 3 + 21 files changed, 133 insertions(+), 14 deletions(-) diff --git a/internal/services/synapse/synapse_firewall_rule_resource_test.go b/internal/services/synapse/synapse_firewall_rule_resource_test.go index 84a943ca3149..675b039853c6 100644 --- a/internal/services/synapse/synapse_firewall_rule_resource_test.go +++ b/internal/services/synapse/synapse_firewall_rule_resource_test.go @@ -158,6 +158,9 @@ resource "azurerm_synapse_workspace" "test" { storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.test.id sql_administrator_login = "sqladminuser" sql_administrator_login_password = "H@Sh1CoR3!" + identity { + type = "SystemAssigned" + } } `, data.RandomInteger, data.Locations.Primary, data.RandomString, data.RandomInteger, data.RandomInteger) } diff --git a/internal/services/synapse/synapse_integration_runtime_azure_resource_test.go b/internal/services/synapse/synapse_integration_runtime_azure_resource_test.go index 8f86769f0619..49ca923cff9d 100644 --- a/internal/services/synapse/synapse_integration_runtime_azure_resource_test.go +++ b/internal/services/synapse/synapse_integration_runtime_azure_resource_test.go @@ -180,6 +180,9 @@ resource "azurerm_synapse_workspace" "test" { sql_administrator_login = "sqladminuser" sql_administrator_login_password = "H@Sh1CoR3!" managed_virtual_network_enabled = true + identity { + type = "SystemAssigned" + } } resource "azurerm_synapse_firewall_rule" "test" { diff --git a/internal/services/synapse/synapse_integration_runtime_self_hosted_resource_test.go b/internal/services/synapse/synapse_integration_runtime_self_hosted_resource_test.go index 33a3b1ad991c..0e13828723f8 100644 --- a/internal/services/synapse/synapse_integration_runtime_self_hosted_resource_test.go +++ b/internal/services/synapse/synapse_integration_runtime_self_hosted_resource_test.go @@ -95,6 +95,9 @@ resource "azurerm_synapse_workspace" "test" { sql_administrator_login = "sqladminuser" sql_administrator_login_password = "H@Sh1CoR3!" managed_virtual_network_enabled = true + identity { + type = "SystemAssigned" + } } resource "azurerm_synapse_firewall_rule" "test" { diff --git a/internal/services/synapse/synapse_linked_service_resource_test.go b/internal/services/synapse/synapse_linked_service_resource_test.go index 3b8b31157d4f..841c67011b1c 100644 --- a/internal/services/synapse/synapse_linked_service_resource_test.go +++ b/internal/services/synapse/synapse_linked_service_resource_test.go @@ -298,6 +298,9 @@ resource "azurerm_synapse_workspace" "test" { sql_administrator_login = "sqladminuser" sql_administrator_login_password = "H@Sh1CoR3!" managed_virtual_network_enabled = true + identity { + type = "SystemAssigned" + } } resource "azurerm_synapse_firewall_rule" "test" { diff --git a/internal/services/synapse/synapse_managed_private_endpoint_resource_test.go b/internal/services/synapse/synapse_managed_private_endpoint_resource_test.go index ff04443116ba..571bb9c9dcc5 100644 --- a/internal/services/synapse/synapse_managed_private_endpoint_resource_test.go +++ b/internal/services/synapse/synapse_managed_private_endpoint_resource_test.go @@ -139,6 +139,9 @@ resource "azurerm_synapse_workspace" "test" { sql_administrator_login = "sqladminuser" sql_administrator_login_password = "H@Sh1CoR3!" managed_virtual_network_enabled = true + identity { + type = "SystemAssigned" + } } resource "azurerm_synapse_firewall_rule" "test" { diff --git a/internal/services/synapse/synapse_role_assignment_resource_test.go b/internal/services/synapse/synapse_role_assignment_resource_test.go index 853dc08e475e..df4a7b6141c8 100644 --- a/internal/services/synapse/synapse_role_assignment_resource_test.go +++ b/internal/services/synapse/synapse_role_assignment_resource_test.go @@ -206,6 +206,9 @@ resource "azurerm_synapse_workspace" "test" { storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.test.id sql_administrator_login = "sqladminuser" sql_administrator_login_password = "H@Sh1CoR3!" + identity { + type = "SystemAssigned" + } } resource "azurerm_synapse_firewall_rule" "test" { diff --git a/internal/services/synapse/synapse_spark_pool_resource_test.go b/internal/services/synapse/synapse_spark_pool_resource_test.go index 0fb0ba49e44b..a60215615eae 100644 --- a/internal/services/synapse/synapse_spark_pool_resource_test.go +++ b/internal/services/synapse/synapse_spark_pool_resource_test.go @@ -295,6 +295,9 @@ resource "azurerm_synapse_workspace" "test" { storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.test.id sql_administrator_login = "sqladminuser" sql_administrator_login_password = "H@Sh1CoR3!" + identity { + type = "SystemAssigned" + } } `, data.RandomInteger, location, data.RandomString, data.RandomInteger, data.RandomInteger) } diff --git a/internal/services/synapse/synapse_sql_pool_extended_auditing_policy_resource_test.go b/internal/services/synapse/synapse_sql_pool_extended_auditing_policy_resource_test.go index 58de675c7400..c8bbaadf5d49 100644 --- a/internal/services/synapse/synapse_sql_pool_extended_auditing_policy_resource_test.go +++ b/internal/services/synapse/synapse_sql_pool_extended_auditing_policy_resource_test.go @@ -211,6 +211,9 @@ resource "azurerm_synapse_workspace" "test" { storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.test.id sql_administrator_login = "sqladminuser" sql_administrator_login_password = "H@Sh1CoR3!" + identity { + type = "SystemAssigned" + } } resource "azurerm_synapse_sql_pool" "test" { diff --git a/internal/services/synapse/synapse_sql_pool_resource_test.go b/internal/services/synapse/synapse_sql_pool_resource_test.go index 0ca9469eaba0..089f410d5355 100644 --- a/internal/services/synapse/synapse_sql_pool_resource_test.go +++ b/internal/services/synapse/synapse_sql_pool_resource_test.go @@ -223,6 +223,9 @@ resource "azurerm_synapse_workspace" "test" { storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.test.id sql_administrator_login = "sqladminuser" sql_administrator_login_password = "H@Sh1CoR3!" + identity { + type = "SystemAssigned" + } } `, data.RandomInteger, data.Locations.Primary, data.RandomString, data.RandomInteger, data.RandomInteger) } diff --git a/internal/services/synapse/synapse_sql_pool_security_alert_policy_resource_test.go b/internal/services/synapse/synapse_sql_pool_security_alert_policy_resource_test.go index 19d04f88dfa5..0e36a8157956 100644 --- a/internal/services/synapse/synapse_sql_pool_security_alert_policy_resource_test.go +++ b/internal/services/synapse/synapse_sql_pool_security_alert_policy_resource_test.go @@ -133,6 +133,9 @@ resource "azurerm_synapse_workspace" "test" { storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.test.id sql_administrator_login = "sqladminuser" sql_administrator_login_password = "H@Sh1CoR3!" + identity { + type = "SystemAssigned" + } } resource "azurerm_synapse_sql_pool" "test" { diff --git a/internal/services/synapse/synapse_sql_pool_vulnerability_assessment_baseline_resource_test.go b/internal/services/synapse/synapse_sql_pool_vulnerability_assessment_baseline_resource_test.go index e679b3f6f87c..8a8e320548ee 100644 --- a/internal/services/synapse/synapse_sql_pool_vulnerability_assessment_baseline_resource_test.go +++ b/internal/services/synapse/synapse_sql_pool_vulnerability_assessment_baseline_resource_test.go @@ -181,6 +181,9 @@ resource "azurerm_synapse_workspace" "test" { storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.test.id sql_administrator_login = "sqladminuser" sql_administrator_login_password = "H@Sh1CoR3!" + identity { + type = "SystemAssigned" + } } resource "azurerm_synapse_sql_pool" "test" { diff --git a/internal/services/synapse/synapse_sql_pool_vulnerability_assessment_resource_test.go b/internal/services/synapse/synapse_sql_pool_vulnerability_assessment_resource_test.go index ab4ef54d5504..36f790a8696c 100644 --- a/internal/services/synapse/synapse_sql_pool_vulnerability_assessment_resource_test.go +++ b/internal/services/synapse/synapse_sql_pool_vulnerability_assessment_resource_test.go @@ -134,6 +134,9 @@ resource "azurerm_synapse_workspace" "test" { storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.test.id sql_administrator_login = "sqladminuser" sql_administrator_login_password = "H@Sh1CoR3!" + identity { + type = "SystemAssigned" + } } resource "azurerm_synapse_sql_pool" "test" { diff --git a/internal/services/synapse/synapse_sql_pool_workload_classifier_resource_test.go b/internal/services/synapse/synapse_sql_pool_workload_classifier_resource_test.go index a6b0ea2c7542..eeca27d59a5a 100644 --- a/internal/services/synapse/synapse_sql_pool_workload_classifier_resource_test.go +++ b/internal/services/synapse/synapse_sql_pool_workload_classifier_resource_test.go @@ -184,6 +184,9 @@ resource "azurerm_synapse_workspace" "test" { storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.test.id sql_administrator_login = "sqladminuser" sql_administrator_login_password = "H@Sh1CoR3!" + identity { + type = "SystemAssigned" + } } resource "azurerm_synapse_sql_pool" "test" { diff --git a/internal/services/synapse/synapse_sql_pool_workload_group_resource_test.go b/internal/services/synapse/synapse_sql_pool_workload_group_resource_test.go index acb932e77e6d..cdcf456b7f8d 100644 --- a/internal/services/synapse/synapse_sql_pool_workload_group_resource_test.go +++ b/internal/services/synapse/synapse_sql_pool_workload_group_resource_test.go @@ -186,6 +186,9 @@ resource "azurerm_synapse_workspace" "test" { storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.test.id sql_administrator_login = "sqladminuser" sql_administrator_login_password = "H@Sh1CoR3!" + identity { + type = "SystemAssigned" + } } resource "azurerm_synapse_sql_pool" "test" { diff --git a/internal/services/synapse/synapse_workspace_aad_admin_resource_test.go b/internal/services/synapse/synapse_workspace_aad_admin_resource_test.go index b351422f94ae..a92c1db702da 100644 --- a/internal/services/synapse/synapse_workspace_aad_admin_resource_test.go +++ b/internal/services/synapse/synapse_workspace_aad_admin_resource_test.go @@ -99,6 +99,10 @@ resource "azurerm_synapse_workspace" "test" { storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.test.id sql_administrator_login = "sqladminuser" sql_administrator_login_password = "H@Sh1CoR3!" + + identity { + type = "SystemAssigned" + } } `, data.RandomInteger, data.Locations.Primary, data.RandomString, data.RandomInteger, data.RandomInteger) } diff --git a/internal/services/synapse/synapse_workspace_extended_auditing_policy_resource_test.go b/internal/services/synapse/synapse_workspace_extended_auditing_policy_resource_test.go index 5f34706e7fd6..d4c6fe0c177d 100644 --- a/internal/services/synapse/synapse_workspace_extended_auditing_policy_resource_test.go +++ b/internal/services/synapse/synapse_workspace_extended_auditing_policy_resource_test.go @@ -211,6 +211,9 @@ resource "azurerm_synapse_workspace" "test" { storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.test.id sql_administrator_login = "sqladminuser" sql_administrator_login_password = "H@Sh1CoR3!" + identity { + type = "SystemAssigned" + } } resource "azurerm_storage_account" "test" { diff --git a/internal/services/synapse/synapse_workspace_key_resource_test.go b/internal/services/synapse/synapse_workspace_key_resource_test.go index 1577fbf6ef24..d9a556810df1 100644 --- a/internal/services/synapse/synapse_workspace_key_resource_test.go +++ b/internal/services/synapse/synapse_workspace_key_resource_test.go @@ -100,7 +100,9 @@ resource "azurerm_synapse_workspace" "test" { key_name = "test_key" } - + identity { + type = "SystemAssigned" + } } diff --git a/internal/services/synapse/synapse_workspace_resource_test.go b/internal/services/synapse/synapse_workspace_resource_test.go index b53ec7fdbe64..d9981ab09105 100644 --- a/internal/services/synapse/synapse_workspace_resource_test.go +++ b/internal/services/synapse/synapse_workspace_resource_test.go @@ -202,7 +202,7 @@ func (r SynapseWorkspaceResource) Exists(ctx context.Context, client *clients.Cl func (r SynapseWorkspaceResource) basic(data acceptance.TestData) string { template := r.template(data) - if !features.ThreePointOhBeta() { + if !features.ThreePointOh() { return fmt.Sprintf(` %s @@ -237,7 +237,7 @@ resource "azurerm_synapse_workspace" "test" { func (r SynapseWorkspaceResource) requiresImport(data acceptance.TestData) string { config := r.basic(data) - if !features.ThreePointOhBeta() { + if !features.ThreePointOh() { return fmt.Sprintf(` %s @@ -271,7 +271,8 @@ resource "azurerm_synapse_workspace" "import" { func (r SynapseWorkspaceResource) complete(data acceptance.TestData) string { template := r.template(data) - if !features.ThreePointOhBeta() { + + if features.ThreePointOhBeta() { return fmt.Sprintf(` %s @@ -282,7 +283,10 @@ resource "azurerm_purview_account" "test" { name = "acctestacc%s" resource_group_name = azurerm_resource_group.test.name location = "%s" - sku_name = "Standard_1" + + identity { + type = "SystemAssigned" + } } resource "azurerm_virtual_network" "test" { @@ -321,7 +325,9 @@ resource "azurerm_synapse_workspace" "test" { } `, template, data.RandomString, data.Locations.Secondary, data.RandomString, data.RandomString, data.RandomInteger, data.RandomInteger) } - return fmt.Sprintf(` + + if features.ThreePointOh() { + return fmt.Sprintf(` %s data "azurerm_client_config" "current" {} @@ -331,7 +337,10 @@ resource "azurerm_purview_account" "test" { name = "acctestacc%s" resource_group_name = azurerm_resource_group.test.name location = "%s" - sku_name = "Standard_1" + + identity { + type = "SystemAssigned" + } } resource "azurerm_virtual_network" "test" { @@ -372,12 +381,62 @@ resource "azurerm_synapse_workspace" "test" { ENV = "Test" } } +`, template, data.RandomString, data.Locations.Secondary, data.RandomString, data.RandomString, data.RandomInteger, data.RandomInteger) + + } + + return fmt.Sprintf(` +%s + +data "azurerm_client_config" "current" {} + + +resource "azurerm_purview_account" "test" { + name = "acctestacc%s" + resource_group_name = azurerm_resource_group.test.name + location = "%s" +} + +resource "azurerm_virtual_network" "test" { + name = "%s-vnet" + address_space = ["10.0.0.0/16"] + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name +} + +resource "azurerm_subnet" "test" { + name = "%s-subnet" + resource_group_name = azurerm_resource_group.test.name + virtual_network_name = azurerm_virtual_network.test.name + address_prefixes = ["10.0.1.0/24"] +} + +resource "azurerm_synapse_workspace" "test" { + name = "acctestsw%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.test.id + sql_administrator_login = "sqladminuser" + sql_administrator_login_password = "H@Sh1CoR3!" + data_exfiltration_protection_enabled = true + managed_virtual_network_enabled = true + managed_resource_group_name = "acctest-ManagedSynapse-%d" + sql_identity_control_enabled = true + public_network_access_enabled = false + linking_allowed_for_aad_tenant_ids = [data.azurerm_client_config.current.tenant_id] + purview_id = azurerm_purview_account.test.id + compute_subnet_id = azurerm_subnet.test.id + + tags = { + ENV = "Test" + } +} `, template, data.RandomString, data.Locations.Secondary, data.RandomString, data.RandomString, data.RandomInteger, data.RandomInteger) } func (r SynapseWorkspaceResource) withAadAdmin(data acceptance.TestData) string { template := r.template(data) - if !features.ThreePointOhBeta() { + if !features.ThreePointOh() { return fmt.Sprintf(` %s @@ -437,7 +496,7 @@ resource "azurerm_synapse_workspace" "test" { func (r SynapseWorkspaceResource) withSqlAadAdmin(data acceptance.TestData) string { template := r.template(data) - if !features.ThreePointOhBeta() { + if !features.ThreePointOh() { return fmt.Sprintf(` %s @@ -499,7 +558,7 @@ resource "azurerm_synapse_workspace" "test" { func (r SynapseWorkspaceResource) withAadAdmins(data acceptance.TestData) string { template := r.template(data) - if !features.ThreePointOhBeta() { + if !features.ThreePointOh() { return fmt.Sprintf(` %s @@ -571,7 +630,7 @@ resource "azurerm_synapse_workspace" "test" { func (r SynapseWorkspaceResource) azureDevOps(data acceptance.TestData) string { template := r.template(data) - if !features.ThreePointOhBeta() { + if !features.ThreePointOh() { return fmt.Sprintf(` %s @@ -623,7 +682,7 @@ resource "azurerm_synapse_workspace" "test" { func (r SynapseWorkspaceResource) azureDevOpsTenant(data acceptance.TestData) string { template := r.template(data) - if !features.ThreePointOhBeta() { + if !features.ThreePointOh() { return fmt.Sprintf(` %s @@ -679,7 +738,7 @@ resource "azurerm_synapse_workspace" "test" { func (r SynapseWorkspaceResource) github(data acceptance.TestData) string { template := r.template(data) - if !features.ThreePointOhBeta() { + if !features.ThreePointOh() { return fmt.Sprintf(` %s @@ -731,7 +790,7 @@ resource "azurerm_synapse_workspace" "test" { func (r SynapseWorkspaceResource) customerManagedKey(data acceptance.TestData) string { template := r.template(data) - if !features.ThreePointOhBeta() { + if !features.ThreePointOh() { return fmt.Sprintf(` %s diff --git a/internal/services/synapse/synapse_workspace_security_alert_policy_resource_test.go b/internal/services/synapse/synapse_workspace_security_alert_policy_resource_test.go index 682b4a10ce3b..73d1010f1201 100644 --- a/internal/services/synapse/synapse_workspace_security_alert_policy_resource_test.go +++ b/internal/services/synapse/synapse_workspace_security_alert_policy_resource_test.go @@ -133,6 +133,9 @@ resource "azurerm_synapse_workspace" "test" { storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.test.id sql_administrator_login = "sqladminuser" sql_administrator_login_password = "H@Sh1CoR3!" + identity { + type = "SystemAssigned" + } } `, data.RandomInteger, data.Locations.Primary, data.RandomString) } diff --git a/internal/services/synapse/synapse_workspace_sql_aad_admin_resource_test.go b/internal/services/synapse/synapse_workspace_sql_aad_admin_resource_test.go index 395da1e9925f..ed52337080e2 100644 --- a/internal/services/synapse/synapse_workspace_sql_aad_admin_resource_test.go +++ b/internal/services/synapse/synapse_workspace_sql_aad_admin_resource_test.go @@ -99,6 +99,9 @@ resource "azurerm_synapse_workspace" "test" { storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.test.id sql_administrator_login = "sqladminuser" sql_administrator_login_password = "H@Sh1CoR3!" + identity { + type = "SystemAssigned" + } } `, data.RandomInteger, data.Locations.Primary, data.RandomString, data.RandomInteger, data.RandomInteger) } diff --git a/internal/services/synapse/synapse_workspace_vulnerability_assessment_resource_test.go b/internal/services/synapse/synapse_workspace_vulnerability_assessment_resource_test.go index b51d671a348a..46278ddb1fb2 100644 --- a/internal/services/synapse/synapse_workspace_vulnerability_assessment_resource_test.go +++ b/internal/services/synapse/synapse_workspace_vulnerability_assessment_resource_test.go @@ -134,6 +134,9 @@ resource "azurerm_synapse_workspace" "test" { storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.test.id sql_administrator_login = "sqladminuser" sql_administrator_login_password = "H@Sh1CoR3!" + identity { + type = "SystemAssigned" + } } resource "azurerm_storage_account" "test" { From 1928693b17af90b1e5f5d91eb632523328cc1b47 Mon Sep 17 00:00:00 2001 From: henglu Date: Tue, 22 Mar 2022 10:19:25 +0800 Subject: [PATCH 2/2] remove features flags --- ..._extended_auditing_policy_resource_test.go | 3 +- ..._extended_auditing_policy_resource_test.go | 3 +- .../synapse_workspace_resource_test.go | 349 +----------------- 3 files changed, 3 insertions(+), 352 deletions(-) diff --git a/internal/services/synapse/synapse_sql_pool_extended_auditing_policy_resource_test.go b/internal/services/synapse/synapse_sql_pool_extended_auditing_policy_resource_test.go index c8bbaadf5d49..f596bcbc4a3b 100644 --- a/internal/services/synapse/synapse_sql_pool_extended_auditing_policy_resource_test.go +++ b/internal/services/synapse/synapse_sql_pool_extended_auditing_policy_resource_test.go @@ -313,8 +313,7 @@ resource "azurerm_subnet" "test" { } resource "azurerm_storage_account_network_rules" "test" { - resource_group_name = azurerm_resource_group.test.name - storage_account_name = azurerm_storage_account.test.name + storage_account_id = azurerm_storage_account.test.id default_action = "Deny" ip_rules = ["127.0.0.1"] virtual_network_subnet_ids = [azurerm_subnet.test.id] diff --git a/internal/services/synapse/synapse_workspace_extended_auditing_policy_resource_test.go b/internal/services/synapse/synapse_workspace_extended_auditing_policy_resource_test.go index d4c6fe0c177d..77c50645f6dc 100644 --- a/internal/services/synapse/synapse_workspace_extended_auditing_policy_resource_test.go +++ b/internal/services/synapse/synapse_workspace_extended_auditing_policy_resource_test.go @@ -306,8 +306,7 @@ resource "azurerm_subnet" "test" { } resource "azurerm_storage_account_network_rules" "test" { - resource_group_name = azurerm_resource_group.test.name - storage_account_name = azurerm_storage_account.test.name + storage_account_id = azurerm_storage_account.test.id default_action = "Deny" ip_rules = ["127.0.0.1"] virtual_network_subnet_ids = [azurerm_subnet.test.id] diff --git a/internal/services/synapse/synapse_workspace_resource_test.go b/internal/services/synapse/synapse_workspace_resource_test.go index d9981ab09105..5335471c5c07 100644 --- a/internal/services/synapse/synapse_workspace_resource_test.go +++ b/internal/services/synapse/synapse_workspace_resource_test.go @@ -8,7 +8,6 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/features" "github.com/hashicorp/terraform-provider-azurerm/internal/services/synapse/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" @@ -201,22 +200,6 @@ func (r SynapseWorkspaceResource) Exists(ctx context.Context, client *clients.Cl func (r SynapseWorkspaceResource) basic(data acceptance.TestData) string { template := r.template(data) - - if !features.ThreePointOh() { - return fmt.Sprintf(` -%s - -resource "azurerm_synapse_workspace" "test" { - name = "acctestsw%d" - resource_group_name = azurerm_resource_group.test.name - location = azurerm_resource_group.test.location - storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.test.id - sql_administrator_login = "sqladminuser" - sql_administrator_login_password = "H@Sh1CoR3!" -} -`, template, data.RandomInteger) - } - return fmt.Sprintf(` %s @@ -237,20 +220,6 @@ resource "azurerm_synapse_workspace" "test" { func (r SynapseWorkspaceResource) requiresImport(data acceptance.TestData) string { config := r.basic(data) - if !features.ThreePointOh() { - return fmt.Sprintf(` -%s - -resource "azurerm_synapse_workspace" "import" { - name = azurerm_synapse_workspace.test.name - resource_group_name = azurerm_synapse_workspace.test.resource_group_name - location = azurerm_synapse_workspace.test.location - storage_data_lake_gen2_filesystem_id = azurerm_synapse_workspace.test.storage_data_lake_gen2_filesystem_id - sql_administrator_login = azurerm_synapse_workspace.test.sql_administrator_login - sql_administrator_login_password = azurerm_synapse_workspace.test.sql_administrator_login_password -} -`, config) - } return fmt.Sprintf(` %s @@ -271,63 +240,7 @@ resource "azurerm_synapse_workspace" "import" { func (r SynapseWorkspaceResource) complete(data acceptance.TestData) string { template := r.template(data) - - if features.ThreePointOhBeta() { - return fmt.Sprintf(` -%s - -data "azurerm_client_config" "current" {} - - -resource "azurerm_purview_account" "test" { - name = "acctestacc%s" - resource_group_name = azurerm_resource_group.test.name - location = "%s" - - identity { - type = "SystemAssigned" - } -} - -resource "azurerm_virtual_network" "test" { - name = "%s-vnet" - address_space = ["10.0.0.0/16"] - location = azurerm_resource_group.test.location - resource_group_name = azurerm_resource_group.test.name -} - -resource "azurerm_subnet" "test" { - name = "%s-subnet" - resource_group_name = azurerm_resource_group.test.name - virtual_network_name = azurerm_virtual_network.test.name - address_prefixes = ["10.0.1.0/24"] -} - -resource "azurerm_synapse_workspace" "test" { - name = "acctestsw%d" - resource_group_name = azurerm_resource_group.test.name - location = azurerm_resource_group.test.location - storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.test.id - sql_administrator_login = "sqladminuser" - sql_administrator_login_password = "H@Sh1CoR3!" - data_exfiltration_protection_enabled = true - managed_virtual_network_enabled = true - managed_resource_group_name = "acctest-ManagedSynapse-%d" - sql_identity_control_enabled = true - public_network_access_enabled = false - linking_allowed_for_aad_tenant_ids = [data.azurerm_client_config.current.tenant_id] - purview_id = azurerm_purview_account.test.id - compute_subnet_id = azurerm_subnet.test.id - - tags = { - ENV = "Test" - } -} -`, template, data.RandomString, data.Locations.Secondary, data.RandomString, data.RandomString, data.RandomInteger, data.RandomInteger) - } - - if features.ThreePointOh() { - return fmt.Sprintf(` + return fmt.Sprintf(` %s data "azurerm_client_config" "current" {} @@ -381,88 +294,11 @@ resource "azurerm_synapse_workspace" "test" { ENV = "Test" } } -`, template, data.RandomString, data.Locations.Secondary, data.RandomString, data.RandomString, data.RandomInteger, data.RandomInteger) - - } - - return fmt.Sprintf(` -%s - -data "azurerm_client_config" "current" {} - - -resource "azurerm_purview_account" "test" { - name = "acctestacc%s" - resource_group_name = azurerm_resource_group.test.name - location = "%s" -} - -resource "azurerm_virtual_network" "test" { - name = "%s-vnet" - address_space = ["10.0.0.0/16"] - location = azurerm_resource_group.test.location - resource_group_name = azurerm_resource_group.test.name -} - -resource "azurerm_subnet" "test" { - name = "%s-subnet" - resource_group_name = azurerm_resource_group.test.name - virtual_network_name = azurerm_virtual_network.test.name - address_prefixes = ["10.0.1.0/24"] -} - -resource "azurerm_synapse_workspace" "test" { - name = "acctestsw%d" - resource_group_name = azurerm_resource_group.test.name - location = azurerm_resource_group.test.location - storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.test.id - sql_administrator_login = "sqladminuser" - sql_administrator_login_password = "H@Sh1CoR3!" - data_exfiltration_protection_enabled = true - managed_virtual_network_enabled = true - managed_resource_group_name = "acctest-ManagedSynapse-%d" - sql_identity_control_enabled = true - public_network_access_enabled = false - linking_allowed_for_aad_tenant_ids = [data.azurerm_client_config.current.tenant_id] - purview_id = azurerm_purview_account.test.id - compute_subnet_id = azurerm_subnet.test.id - - tags = { - ENV = "Test" - } -} `, template, data.RandomString, data.Locations.Secondary, data.RandomString, data.RandomString, data.RandomInteger, data.RandomInteger) } func (r SynapseWorkspaceResource) withAadAdmin(data acceptance.TestData) string { template := r.template(data) - if !features.ThreePointOh() { - return fmt.Sprintf(` -%s - -data "azurerm_client_config" "current" { -} - -resource "azurerm_synapse_workspace" "test" { - name = "acctestsw%d" - resource_group_name = azurerm_resource_group.test.name - location = azurerm_resource_group.test.location - storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.test.id - sql_administrator_login = "sqladminuser" - sql_administrator_login_password = "H@Sh1CoR4!" - sql_identity_control_enabled = true - aad_admin { - login = "AzureAD Admin" - object_id = data.azurerm_client_config.current.object_id - tenant_id = data.azurerm_client_config.current.tenant_id - } - - tags = { - ENV = "Test2" - } -} -`, template, data.RandomInteger) - } return fmt.Sprintf(` %s @@ -496,34 +332,6 @@ resource "azurerm_synapse_workspace" "test" { func (r SynapseWorkspaceResource) withSqlAadAdmin(data acceptance.TestData) string { template := r.template(data) - if !features.ThreePointOh() { - return fmt.Sprintf(` -%s - -data "azurerm_client_config" "current" { -} - -resource "azurerm_synapse_workspace" "test" { - name = "acctestsw%d" - resource_group_name = azurerm_resource_group.test.name - location = azurerm_resource_group.test.location - storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.test.id - sql_administrator_login = "sqladminuser" - sql_administrator_login_password = "H@Sh1CoR4!" - sql_identity_control_enabled = true - - sql_aad_admin { - login = "AzureAD Admin" - object_id = data.azurerm_client_config.current.object_id - tenant_id = data.azurerm_client_config.current.tenant_id - } - - tags = { - ENV = "Test2" - } -} -`, template, data.RandomInteger) - } return fmt.Sprintf(` %s @@ -558,39 +366,6 @@ resource "azurerm_synapse_workspace" "test" { func (r SynapseWorkspaceResource) withAadAdmins(data acceptance.TestData) string { template := r.template(data) - if !features.ThreePointOh() { - return fmt.Sprintf(` -%s - -data "azurerm_client_config" "current" { -} - -resource "azurerm_synapse_workspace" "test" { - name = "acctestsw%d" - resource_group_name = azurerm_resource_group.test.name - location = azurerm_resource_group.test.location - storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.test.id - sql_administrator_login = "sqladminuser" - sql_administrator_login_password = "H@Sh1CoR4!" - sql_identity_control_enabled = true - aad_admin { - login = "AzureAD Admin" - object_id = data.azurerm_client_config.current.object_id - tenant_id = data.azurerm_client_config.current.tenant_id - } - - sql_aad_admin { - login = "AzureAD Admin" - object_id = data.azurerm_client_config.current.object_id - tenant_id = data.azurerm_client_config.current.tenant_id - } - - tags = { - ENV = "Test2" - } -} -`, template, data.RandomInteger) - } return fmt.Sprintf(` %s @@ -630,29 +405,6 @@ resource "azurerm_synapse_workspace" "test" { func (r SynapseWorkspaceResource) azureDevOps(data acceptance.TestData) string { template := r.template(data) - if !features.ThreePointOh() { - return fmt.Sprintf(` -%s - -resource "azurerm_synapse_workspace" "test" { - name = "acctestsw%d" - resource_group_name = azurerm_resource_group.test.name - location = azurerm_resource_group.test.location - storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.test.id - sql_administrator_login = "sqladminuser" - sql_administrator_login_password = "H@Sh1CoR3!" - - azure_devops_repo { - account_name = "myorg" - project_name = "myproj" - repository_name = "myrepo" - branch_name = "dev" - root_folder = "/" - last_commit_id = "1592393b38543d51feb12714cbd39501d697610c" - } -} -`, template, data.RandomInteger) - } return fmt.Sprintf(` %s @@ -682,31 +434,6 @@ resource "azurerm_synapse_workspace" "test" { func (r SynapseWorkspaceResource) azureDevOpsTenant(data acceptance.TestData) string { template := r.template(data) - if !features.ThreePointOh() { - return fmt.Sprintf(` -%s - -data "azurerm_client_config" "current" {} - -resource "azurerm_synapse_workspace" "test" { - name = "acctestsw%d" - resource_group_name = azurerm_resource_group.test.name - location = azurerm_resource_group.test.location - storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.test.id - sql_administrator_login = "sqladminuser" - sql_administrator_login_password = "H@Sh1CoR3!" - - azure_devops_repo { - account_name = "myorg" - project_name = "myproj" - repository_name = "myrepo" - branch_name = "dev" - root_folder = "/" - tenant_id = data.azurerm_client_config.current.tenant_id - } -} -`, template, data.RandomInteger) - } return fmt.Sprintf(` %s @@ -738,29 +465,6 @@ resource "azurerm_synapse_workspace" "test" { func (r SynapseWorkspaceResource) github(data acceptance.TestData) string { template := r.template(data) - if !features.ThreePointOh() { - return fmt.Sprintf(` -%s - -resource "azurerm_synapse_workspace" "test" { - name = "acctestsw%d" - resource_group_name = azurerm_resource_group.test.name - location = azurerm_resource_group.test.location - storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.test.id - sql_administrator_login = "sqladminuser" - sql_administrator_login_password = "H@Sh1CoR3!" - - github_repo { - account_name = "myuser" - git_url = "https://github.mydomain.com" - repository_name = "myrepo" - branch_name = "dev" - root_folder = "/" - last_commit_id = "1592393b38543d51feb12714cbd39501d697610c" - } -} -`, template, data.RandomInteger) - } return fmt.Sprintf(` %s @@ -790,57 +494,6 @@ resource "azurerm_synapse_workspace" "test" { func (r SynapseWorkspaceResource) customerManagedKey(data acceptance.TestData) string { template := r.template(data) - if !features.ThreePointOh() { - return fmt.Sprintf(` -%s - -data "azurerm_client_config" "current" {} - -resource "azurerm_key_vault" "test" { - name = "acckv%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" - purge_protection_enabled = true - - access_policy { - tenant_id = data.azurerm_client_config.current.tenant_id - object_id = data.azurerm_client_config.current.object_id - key_permissions = [ - "Create", - "Get", - "Delete", - "Purge" - ] - } -} - -resource "azurerm_key_vault_key" "test" { - name = "key" - key_vault_id = azurerm_key_vault.test.id - key_type = "RSA" - key_size = 2048 - key_opts = [ - "unwrapKey", - "wrapKey" - ] -} - -resource "azurerm_synapse_workspace" "test" { - name = "acctestsw%d" - resource_group_name = azurerm_resource_group.test.name - location = azurerm_resource_group.test.location - storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.test.id - sql_administrator_login = "sqladminuser" - sql_administrator_login_password = "H@Sh1CoR3!" - customer_managed_key { - key_versionless_id = azurerm_key_vault_key.test.versionless_id - } - -} -`, template, data.RandomInteger, data.RandomInteger) - } return fmt.Sprintf(` %s