Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
wyattfry committed Jan 31, 2025
1 parent 14ae87f commit 307c413
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 259 deletions.
Empty file.
231 changes: 0 additions & 231 deletions examples/mssql/wyatt-config/main.tf

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,12 @@ import (

type MsSqlManagedInstanceFailoverGroupResource struct{}

func TestAccMsSqlManagedInstanceFailoverGroup_basic(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_mssql_managed_instance_failover_group", "test")
r := MsSqlManagedInstanceFailoverGroupResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.basic(data, "basic"),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("secondary_type").Exists(),
),
},
data.ImportStep(),
})
}

func TestAccMsSqlManagedInstanceFailoverGroup_update(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_mssql_managed_instance_failover_group", "test")
r := MsSqlManagedInstanceFailoverGroupResource{}

fmt.Println(r.basic(data, "update"))

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.basic(data, "update"),
Config: r.basic(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
Expand All @@ -53,7 +34,6 @@ func TestAccMsSqlManagedInstanceFailoverGroup_update(t *testing.T) {
Config: r.update(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("secondary_type").HasValue("Standby"),
),
},
data.ImportStep(),
Expand All @@ -77,12 +57,12 @@ func (r MsSqlManagedInstanceFailoverGroupResource) Exists(ctx context.Context, c
return utils.Bool(true), nil
}

func (r MsSqlManagedInstanceFailoverGroupResource) basic(data acceptance.TestData, suffix string) string {
func (r MsSqlManagedInstanceFailoverGroupResource) basic(data acceptance.TestData) string {
return fmt.Sprintf(`
%[1]s
resource "azurerm_mssql_managed_instance_failover_group" "test" {
name = "acctest-fog-%[2]d%[4]s"
name = "acctest-fog-%[2]d"
location = "%[3]s"
managed_instance_id = azurerm_mssql_managed_instance.test.id
partner_managed_instance_id = azurerm_mssql_managed_instance.secondary.id
Expand All @@ -96,7 +76,7 @@ resource "azurerm_mssql_managed_instance_failover_group" "test" {
azurerm_virtual_network_gateway_connection.secondary,
]
}
`, r.template(data), data.RandomInteger, data.Locations.Primary, suffix)
`, r.template(data), data.RandomInteger, data.Locations.Primary)
}

func (r MsSqlManagedInstanceFailoverGroupResource) update(data acceptance.TestData) string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ locals {
primary_name = "${local.name}-primary"
primary_location = "West Europe"
failover_name = "${local.name}-failover"
failover_paired_location = "North Europe"
failover_location = "North Europe"
}
resource "azurerm_mssql_managed_instance_failover_group" "example" {
Expand Down Expand Up @@ -131,7 +131,7 @@ resource "azurerm_virtual_network_peering" "primary_to_failover" {
## Secondary (Fail-over) SQL Managed Instance
resource "azurerm_resource_group" "failover" {
name = local.failover_name
location = local.failover_paired_location
location = local.failover_location
}
resource "azurerm_virtual_network" "failover" {
Expand Down Expand Up @@ -240,7 +240,7 @@ The following arguments are supported:

* `readonly_endpoint_failover_policy_enabled` - (Optional) Failover policy for the read-only endpoint. Defaults to `true`.

* `secondary_type` - (Optional) The type of the secondary Managed Instance. Possible values are `Geo`, `Standby`.
* `secondary_type` - (Optional) The type of the secondary Managed Instance. Possible values are `Geo`, `Standby`. Defaults to `Geo`.

---

Expand Down Expand Up @@ -282,5 +282,5 @@ The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/l
SQL Instance Failover Groups can be imported using the `resource id`, e.g.

```shell
terraform import azurerm_mssql_managed_instance_failover_group.example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Sql/locations/Location/instanceFailoverGroups/failoverGroup1
terraform import azurerm_mssql_managed_instance_failover_group.example /subscriptions/c7694133-4039-4226-8f92-922b1c5449f8/resourceGroups/my-resource-group/providers/Microsoft.Sql/locations/westeurope/instanceFailoverGroups/my-failover-group
```

0 comments on commit 307c413

Please sign in to comment.