From dcfedca969aaa760fe194edd7f81e4fa05a77d43 Mon Sep 17 00:00:00 2001 From: magodo Date: Fri, 27 May 2022 07:39:45 +0800 Subject: [PATCH] `azurerm_active_directory_domain_service` - Add supports for `domain_configuration_type` (#16920) * `azurerm_active_directory_domain_service" - Add supports for `domain_configuration_type` * update test --- .../active_directory_domain_service_resource.go | 15 +++++++++++++++ .../active_directory_domain_service_test.go | 7 ++++--- .../active_directory_domain_service.html.markdown | 2 ++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/internal/services/domainservices/active_directory_domain_service_resource.go b/internal/services/domainservices/active_directory_domain_service_resource.go index 9e2841d9ab37..102a41f641b1 100644 --- a/internal/services/domainservices/active_directory_domain_service_resource.go +++ b/internal/services/domainservices/active_directory_domain_service_resource.go @@ -244,6 +244,16 @@ func resourceActiveDirectoryDomainService() *pluginsdk.Resource { }, }, + "domain_configuration_type": { + Type: pluginsdk.TypeString, + ForceNew: true, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{ + "FullySynced", + "ResourceTrusting", + }, false), + }, + "tags": tags.Schema(), "deployment_id": { @@ -344,6 +354,10 @@ func resourceActiveDirectoryDomainServiceCreateUpdate(d *pluginsdk.ResourceData, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } + if v := d.Get("domain_configuration_type").(string); v != "" { + domainService.DomainServiceProperties.DomainConfigurationType = &v + } + if d.IsNewResource() { // On resource creation, specify the initial replica set. // No provision is made for changing the initial replica set, it should remain intact for the resource to function properly @@ -448,6 +462,7 @@ func resourceActiveDirectoryDomainServiceRead(d *pluginsdk.ResourceData, meta in d.Set("sync_owner", props.SyncOwner) d.Set("tenant_id", props.TenantID) d.Set("version", props.Version) + d.Set("domain_configuration_type", props.DomainConfigurationType) d.Set("filtered_sync_enabled", false) if props.FilteredSync == aad.FilteredSyncEnabled { diff --git a/internal/services/domainservices/active_directory_domain_service_test.go b/internal/services/domainservices/active_directory_domain_service_test.go index 3e6287434653..87e0e8e03976 100644 --- a/internal/services/domainservices/active_directory_domain_service_test.go +++ b/internal/services/domainservices/active_directory_domain_service_test.go @@ -316,9 +316,10 @@ resource "azurerm_active_directory_domain_service" "test" { location = azurerm_resource_group.test.location resource_group_name = azurerm_resource_group.test.name - domain_name = "never.gonna.shut.you.down" - sku = "Enterprise" - filtered_sync_enabled = false + domain_name = "never.gonna.shut.you.down" + sku = "Enterprise" + domain_configuration_type = "FullySynced" + filtered_sync_enabled = false initial_replica_set { subnet_id = azurerm_subnet.aadds.id diff --git a/website/docs/r/active_directory_domain_service.html.markdown b/website/docs/r/active_directory_domain_service.html.markdown index 43564e332b03..de9a8c53c35e 100644 --- a/website/docs/r/active_directory_domain_service.html.markdown +++ b/website/docs/r/active_directory_domain_service.html.markdown @@ -162,6 +162,8 @@ The following arguments are supported: * `domain_name` - (Required) The Active Directory domain to use. See [official documentation](https://docs.microsoft.com/azure/active-directory-domain-services/tutorial-create-instance#create-a-managed-domain) for constraints and recommendations. +* `domain_configuration_type` - (Optional) The configuration type of this Active Directory Domain. Possible values are `FullySynced` and `ResourceTrusting`. Changing this forces a new resource to be created. + * `filtered_sync_enabled` - Whether to enable group-based filtered sync (also called scoped synchronisation). Defaults to `false`. * `secure_ldap` - (Optional) A `secure_ldap` block as defined below.