From f3f9adf992ef292788f6146df8546facd465cb7a Mon Sep 17 00:00:00 2001 From: Raph Date: Wed, 19 Oct 2022 09:09:25 +1100 Subject: [PATCH 1/3] Remove sql password requirement --- internal/services/synapse/synapse_workspace_resource.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/services/synapse/synapse_workspace_resource.go b/internal/services/synapse/synapse_workspace_resource.go index e71372210f78..4c164a60ac1c 100644 --- a/internal/services/synapse/synapse_workspace_resource.go +++ b/internal/services/synapse/synapse_workspace_resource.go @@ -73,14 +73,14 @@ func resourceSynapseWorkspace() *pluginsdk.Resource { "sql_administrator_login": { Type: pluginsdk.TypeString, - Required: true, + Required: false, ForceNew: true, ValidateFunc: validate.SqlAdministratorLoginName, }, "sql_administrator_login_password": { Type: pluginsdk.TypeString, - Required: true, + Required: false, Sensitive: true, }, From 48ccf92abae08050b90750e126a87afa81bf584c Mon Sep 17 00:00:00 2001 From: Raph Date: Fri, 21 Oct 2022 08:11:43 +1100 Subject: [PATCH 2/3] Add optional and add test for `withAadAdminsOnly` --- .../synapse/synapse_workspace_resource.go | 4 +- .../synapse_workspace_resource_test.go | 37 +++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/internal/services/synapse/synapse_workspace_resource.go b/internal/services/synapse/synapse_workspace_resource.go index 4c164a60ac1c..222713f329c3 100644 --- a/internal/services/synapse/synapse_workspace_resource.go +++ b/internal/services/synapse/synapse_workspace_resource.go @@ -73,14 +73,14 @@ func resourceSynapseWorkspace() *pluginsdk.Resource { "sql_administrator_login": { Type: pluginsdk.TypeString, - Required: false, + Optional: true, ForceNew: true, ValidateFunc: validate.SqlAdministratorLoginName, }, "sql_administrator_login_password": { Type: pluginsdk.TypeString, - Required: false, + Optional: true, Sensitive: true, }, diff --git a/internal/services/synapse/synapse_workspace_resource_test.go b/internal/services/synapse/synapse_workspace_resource_test.go index 5335471c5c07..9e5a9bc9a81d 100644 --- a/internal/services/synapse/synapse_workspace_resource_test.go +++ b/internal/services/synapse/synapse_workspace_resource_test.go @@ -403,6 +403,43 @@ resource "azurerm_synapse_workspace" "test" { `, template, data.RandomInteger) } +func (r SynapseWorkspaceResource) withAadAdminsOnly(data acceptance.TestData) string { + template := r.template(data) + 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_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 + } + + identity { + type = "SystemAssigned" + } + + tags = { + ENV = "Test2" + } +} +`, template, data.RandomInteger) +} + func (r SynapseWorkspaceResource) azureDevOps(data acceptance.TestData) string { template := r.template(data) return fmt.Sprintf(` From a665c9a673b260266169e6ffa4b42421221fff3b Mon Sep 17 00:00:00 2001 From: Raph Date: Sat, 22 Oct 2022 10:24:30 +1100 Subject: [PATCH 3/3] Update documentation --- website/docs/r/synapse_workspace.html.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/docs/r/synapse_workspace.html.markdown b/website/docs/r/synapse_workspace.html.markdown index 2e9ebff800d7..d4c46f44f702 100644 --- a/website/docs/r/synapse_workspace.html.markdown +++ b/website/docs/r/synapse_workspace.html.markdown @@ -179,9 +179,9 @@ The following arguments are supported: * `storage_data_lake_gen2_filesystem_id` - (Required) Specifies the ID of storage data lake gen2 filesystem resource. Changing this forces a new resource to be created. -* `sql_administrator_login` - (Required) Specifies The login name of the SQL administrator. Changing this forces a new resource to be created. +* `sql_administrator_login` - (Optional) Specifies The login name of the SQL administrator. Changing this forces a new resource to be created. If this is not provided `aad_admin` or `customer_managed_key` must be provided. -* `sql_administrator_login_password` - (Required) The Password associated with the `sql_administrator_login` for the SQL administrator. +* `sql_administrator_login_password` - (Optional) The Password associated with the `sql_administrator_login` for the SQL administrator. If this is not provided `aad_admin` or `customer_managed_key` must be provided. ---