diff --git a/internal/services/iotcentral/iotcentral_organization_resource_test.go b/internal/services/iotcentral/iotcentral_organization_resource_test.go index 9f8cd63569ff..6c636ecd219b 100644 --- a/internal/services/iotcentral/iotcentral_organization_resource_test.go +++ b/internal/services/iotcentral/iotcentral_organization_resource_test.go @@ -77,75 +77,6 @@ func TestAccIoTCentralOrganization_updateDisplayName(t *testing.T) { }) } -func TestAccIoTCentralOrganization_setParent(t *testing.T) { - data := acceptance.BuildTestData(t, "azurerm_iotcentral_organization", "test") - r := IoTCentralOrganizationResource{} - - data.ResourceTest(t, r, []acceptance.TestStep{ - { - Config: r.basic(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - check.That(data.ResourceName).Key("parent_organization_id").IsEmpty(), - ), - }, - { - Config: r.complete(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - check.That(data.ResourceName).Key("parent_organization_id").IsNotEmpty(), - ), - }, - data.ImportStep(), - }) -} - -func TestAccIoTCentralOrganization_updateParent(t *testing.T) { - data := acceptance.BuildTestData(t, "azurerm_iotcentral_organization", "test") - r := IoTCentralOrganizationResource{} - - data.ResourceTest(t, r, []acceptance.TestStep{ - { - Config: r.complete(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - check.That(data.ResourceName).Key("parent_organization_id").IsNotEmpty(), - ), - }, - { - Config: r.completeUpdateParent(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - check.That(data.ResourceName).Key("parent_organization_id").IsNotEmpty(), - ), - }, - data.ImportStep(), - }) -} - -func TestAccIoTCentralOrganization_unsetParent(t *testing.T) { - data := acceptance.BuildTestData(t, "azurerm_iotcentral_organization", "test") - r := IoTCentralOrganizationResource{} - - data.ResourceTest(t, r, []acceptance.TestStep{ - { - Config: r.complete(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - check.That(data.ResourceName).Key("parent_organization_id").IsNotEmpty(), - ), - }, - { - Config: r.completeUnsetParent(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - check.That(data.ResourceName).Key("parent_organization_id").IsEmpty(), - ), - }, - data.ImportStep(), - }) -} - func (IoTCentralOrganizationResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := parse.OrganizationID(state.ID) if err != nil { @@ -224,51 +155,6 @@ resource "azurerm_iotcentral_organization" "test" { `, r.template(data)) } -func (r IoTCentralOrganizationResource) completeUpdateParent(data acceptance.TestData) string { - return fmt.Sprintf(` -provider "azurerm" { - features {} -} -%s -resource "azurerm_iotcentral_organization" "test_parent" { - iotcentral_application_id = azurerm_iotcentral_application.test.id - organization_id = "org-test-parent-id" - display_name = "Org parent" -} -resource "azurerm_iotcentral_organization" "test_parent_2" { - iotcentral_application_id = azurerm_iotcentral_application.test.id - organization_id = "org-test-parent-2-id" - display_name = "Org parent 2" -} -resource "azurerm_iotcentral_organization" "test" { - iotcentral_application_id = azurerm_iotcentral_application.test.id - organization_id = "org-test-id" - display_name = "Org child" - - parent_organization_id = azurerm_iotcentral_organization.test_parent_2.organization_id -} -`, r.template(data)) -} - -func (r IoTCentralOrganizationResource) completeUnsetParent(data acceptance.TestData) string { - return fmt.Sprintf(` -provider "azurerm" { - features {} -} -%s -resource "azurerm_iotcentral_organization" "test_parent" { - iotcentral_application_id = azurerm_iotcentral_application.test.id - organization_id = "org-test-parent-id" - display_name = "Org parent" -} -resource "azurerm_iotcentral_organization" "test" { - iotcentral_application_id = azurerm_iotcentral_application.test.id - organization_id = "org-test-id" - display_name = "Org child" -} -`, r.template(data)) -} - func (IoTCentralOrganizationResource) template(data acceptance.TestData) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" {