From 49848569e797ce3f1f8f5988cb1c92d0d566bb99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Wed, 5 Jun 2024 16:40:43 +0200 Subject: [PATCH] remove linked_domain property --- .../communication_service_resource.go | 19 +------- .../communication_service_resource_test.go | 48 +------------------ .../r/communication_service.html.markdown | 2 - 3 files changed, 2 insertions(+), 67 deletions(-) diff --git a/internal/services/communication/communication_service_resource.go b/internal/services/communication/communication_service_resource.go index e4fbdbcfd593..f7878b47676a 100644 --- a/internal/services/communication/communication_service_resource.go +++ b/internal/services/communication/communication_service_resource.go @@ -13,7 +13,6 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-sdk/resource-manager/communication/2023-03-31/communicationservices" - "github.com/hashicorp/go-azure-sdk/resource-manager/communication/2023-03-31/domains" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/communication/migration" "github.com/hashicorp/terraform-provider-azurerm/internal/services/communication/validate" @@ -30,7 +29,6 @@ type CommunicationServiceResourceModel struct { Name string `tfschema:"name"` ResourceGroupName string `tfschema:"resource_group_name"` DataLocation string `tfschema:"data_location"` - LinkedDomains []string `tfschema:"linked_domains"` Tags map[string]string `tfschema:"tags"` PrimaryConnectionString string `tfschema:"primary_connection_string"` @@ -85,15 +83,6 @@ func (CommunicationServiceResource) Arguments() map[string]*pluginsdk.Schema { }, false), }, - "linked_domains": { - Type: pluginsdk.TypeList, - Optional: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - ValidateFunc: domains.ValidateDomainID, - }, - }, - "tags": commonschema.Tags(), } } @@ -157,8 +146,7 @@ func (r CommunicationServiceResource) Create() sdk.ResourceFunc { // The location is always `global` from the Azure Portal Location: location.Normalize("global"), Properties: &communicationservices.CommunicationServiceProperties{ - DataLocation: model.DataLocation, - LinkedDomains: pointer.To(model.LinkedDomains), + DataLocation: model.DataLocation, }, Tags: pointer.To(model.Tags), } @@ -203,10 +191,6 @@ func (r CommunicationServiceResource) Update() sdk.ResourceFunc { props.DataLocation = model.DataLocation } - if metadata.ResourceData.HasChange("linked_domains") { - props.LinkedDomains = pointer.To(model.LinkedDomains) - } - existing.Model.Properties = &props if metadata.ResourceData.HasChange("tags") { @@ -255,7 +239,6 @@ func (CommunicationServiceResource) Read() sdk.ResourceFunc { if model := resp.Model; model != nil { if props := model.Properties; props != nil { state.DataLocation = props.DataLocation - state.LinkedDomains = pointer.From(props.LinkedDomains) } state.Tags = pointer.From(model.Tags) diff --git a/internal/services/communication/communication_service_resource_test.go b/internal/services/communication/communication_service_resource_test.go index e81db1fdcfce..bcb5284f8c6b 100644 --- a/internal/services/communication/communication_service_resource_test.go +++ b/internal/services/communication/communication_service_resource_test.go @@ -82,22 +82,6 @@ func TestAccCommunicationService_update(t *testing.T) { data.ImportStep(), { Config: r.update(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - check.That(data.ResourceName).Key("linked_domains").DoesNotExist(), - ), - }, - data.ImportStep(), - }) -} - -func TestAccCommunicationService_linkedDomainsEmpty(t *testing.T) { - data := acceptance.BuildTestData(t, "azurerm_communication_service", "test") - r := CommunicationServiceTestResource{} - - data.ResourceTest(t, r, []acceptance.TestStep{ - { - Config: r.emptyLinkedDomains(data), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), @@ -153,23 +137,10 @@ func (r CommunicationServiceTestResource) complete(data acceptance.TestData) str return fmt.Sprintf(` %s -resource "azurerm_email_communication_service" "test" { - name = "acctest-CommunicationService-%[2]d" - resource_group_name = azurerm_resource_group.test.name - data_location = "United States" -} - -resource "azurerm_email_communication_service_domain" "test" { - name = "AzureManagedDomain" - email_service_id = azurerm_email_communication_service.test.id - domain_management = "AzureManaged" -} - resource "azurerm_communication_service" "test" { - name = "acctest-CommunicationService-%[2]d" + name = "acctest-CommunicationService-%d" resource_group_name = azurerm_resource_group.test.name data_location = "United States" - linked_domains = [azurerm_email_communication_service_domain.test.id] tags = { env = "Test" @@ -194,23 +165,6 @@ resource "azurerm_communication_service" "test" { `, r.template(data), data.RandomInteger) } -func (r CommunicationServiceTestResource) emptyLinkedDomains(data acceptance.TestData) string { - return fmt.Sprintf(` -%s - -resource "azurerm_communication_service" "test" { - name = "acctest-CommunicationService-%d" - resource_group_name = azurerm_resource_group.test.name - data_location = "United States" - linked_domains = [] - - tags = { - env = "Test2" - } -} -`, r.template(data), data.RandomInteger) -} - func (r CommunicationServiceTestResource) template(data acceptance.TestData) string { return fmt.Sprintf(` provider "azurerm" { diff --git a/website/docs/r/communication_service.html.markdown b/website/docs/r/communication_service.html.markdown index 2f138f0db2ec..9d5aae8f44a8 100644 --- a/website/docs/r/communication_service.html.markdown +++ b/website/docs/r/communication_service.html.markdown @@ -35,8 +35,6 @@ The following arguments are supported: --- -* `linked_domains` - (Optional) A list of email domain resource IDs - * `data_location` - (Optional) The location where the Communication service stores its data at rest. Possible values are `Africa`, `Asia Pacific`, `Australia`, `Brazil`, `Canada`, `Europe`, `France`, `Germany`, `India`, `Japan`, `Korea`, `Norway`, `Switzerland`, `UAE`, `UK` and `United States`. Defaults to `United States`. Changing this forces a new Communication Service to be created. * `tags` - (Optional) A mapping of tags which should be assigned to the Communication Service.