Skip to content

Commit

Permalink
remove linked_domain property
Browse files Browse the repository at this point in the history
  • Loading branch information
jkroepke committed Jun 5, 2024
1 parent 118ccc1 commit 4984856
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"`
Expand Down Expand Up @@ -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(),
}
}
Expand Down Expand Up @@ -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),
}
Expand Down Expand Up @@ -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") {
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
),
Expand Down Expand Up @@ -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"
Expand All @@ -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" {
Expand Down
2 changes: 0 additions & 2 deletions website/docs/r/communication_service.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 4984856

Please sign in to comment.