diff --git a/azurerm/internal/services/postgres/resource_arm_postgresql_configuration.go b/azurerm/internal/services/postgres/resource_arm_postgresql_configuration.go index 2b1a44c6c814..3a3327b8d834 100644 --- a/azurerm/internal/services/postgres/resource_arm_postgresql_configuration.go +++ b/azurerm/internal/services/postgres/resource_arm_postgresql_configuration.go @@ -40,9 +40,10 @@ func resourceArmPostgreSQLConfiguration() *schema.Resource { "resource_group_name": azure.SchemaResourceGroupName(), "server_name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: ValidatePSQLServerName, }, "value": { diff --git a/azurerm/internal/services/postgres/resource_arm_postgresql_database.go b/azurerm/internal/services/postgres/resource_arm_postgresql_database.go index 8bf61154da4a..17107273427e 100644 --- a/azurerm/internal/services/postgres/resource_arm_postgresql_database.go +++ b/azurerm/internal/services/postgres/resource_arm_postgresql_database.go @@ -44,9 +44,10 @@ func resourceArmPostgreSQLDatabase() *schema.Resource { "resource_group_name": azure.SchemaResourceGroupName(), "server_name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: ValidatePSQLServerName, }, "charset": { diff --git a/azurerm/internal/services/postgres/resource_arm_postgresql_firewall_rule.go b/azurerm/internal/services/postgres/resource_arm_postgresql_firewall_rule.go index da0b55b31c64..bb5c0e2242aa 100644 --- a/azurerm/internal/services/postgres/resource_arm_postgresql_firewall_rule.go +++ b/azurerm/internal/services/postgres/resource_arm_postgresql_firewall_rule.go @@ -42,9 +42,10 @@ func resourceArmPostgreSQLFirewallRule() *schema.Resource { "resource_group_name": azure.SchemaResourceGroupName(), "server_name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: ValidatePSQLServerName, }, "start_ip_address": { diff --git a/azurerm/internal/services/postgres/resource_arm_postgresql_server.go b/azurerm/internal/services/postgres/resource_arm_postgresql_server.go index 5dd8ee7fcea5..2c0400f46b6a 100644 --- a/azurerm/internal/services/postgres/resource_arm_postgresql_server.go +++ b/azurerm/internal/services/postgres/resource_arm_postgresql_server.go @@ -22,6 +22,14 @@ import ( "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" ) +func ValidatePSQLServerName(i interface{}, k string) (_ []string, errors []error) { + if m, regexErrs := validate.RegExHelper(i, k, `^[0-9a-z]{2}[-0-9a-z]{0,60}[0-9a-z]$`); !m { + errors = append(regexErrs, fmt.Errorf("%q can contain only lowercase letters, numbers, and '-', but can't start or end with '-' or have more than 63 characters.", k)) + } + + return nil, errors +} + func resourceArmPostgreSQLServer() *schema.Resource { return &schema.Resource{ Create: resourceArmPostgreSQLServerCreate, @@ -41,9 +49,10 @@ func resourceArmPostgreSQLServer() *schema.Resource { Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: ValidatePSQLServerName, }, "location": azure.SchemaLocation(), diff --git a/azurerm/internal/services/postgres/resource_arm_postgresql_virtual_network_rule.go b/azurerm/internal/services/postgres/resource_arm_postgresql_virtual_network_rule.go index 613d9c34e409..88e37caf7afc 100644 --- a/azurerm/internal/services/postgres/resource_arm_postgresql_virtual_network_rule.go +++ b/azurerm/internal/services/postgres/resource_arm_postgresql_virtual_network_rule.go @@ -50,7 +50,7 @@ func resourceArmPostgreSQLVirtualNetworkRule() *schema.Resource { Type: schema.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.NoEmptyStrings, + ValidateFunc: ValidatePSQLServerName, }, "subnet_id": { diff --git a/azurerm/internal/services/postgres/tests/data_source_postgresql_server_test.go b/azurerm/internal/services/postgres/tests/data_source_postgresql_server_test.go index 58452aa667b4..259ab7507e43 100644 --- a/azurerm/internal/services/postgres/tests/data_source_postgresql_server_test.go +++ b/azurerm/internal/services/postgres/tests/data_source_postgresql_server_test.go @@ -33,7 +33,6 @@ func TestAccDataSourceAzureRMPPostgreSqlServer_basic(t *testing.T) { } func testAccDataSourceAzureRMPostgreSqlServer_basic(data acceptance.TestData, version string) string { - template := testAccAzureRMPostgreSQLServer_basic(data, version) return fmt.Sprintf(` %s @@ -41,5 +40,5 @@ data "azurerm_postgresql_server" "test" { name = "${azurerm_postgresql_server.test.name}" resource_group_name = "${azurerm_resource_group.test.name}" } -`, template) +`, testAccAzureRMPostgreSQLServer_basic(data, version)) } diff --git a/azurerm/internal/services/postgres/tests/resource_arm_postgresql_configuration_test.go b/azurerm/internal/services/postgres/tests/resource_arm_postgresql_configuration_test.go index 1957a6298d59..68a5cbd193e4 100644 --- a/azurerm/internal/services/postgres/tests/resource_arm_postgresql_configuration_test.go +++ b/azurerm/internal/services/postgres/tests/resource_arm_postgresql_configuration_test.go @@ -126,8 +126,8 @@ func testCheckAzureRMPostgreSQLConfigurationValueReset(rInt int, configurationNa client := acceptance.AzureProvider.Meta().(*clients.Client).Postgres.ConfigurationsClient ctx := acceptance.AzureProvider.Meta().(*clients.Client).StopContext - resourceGroup := fmt.Sprintf("acctestRG-%d", rInt) - serverName := fmt.Sprintf("acctestpsqlsvr-%d", rInt) + resourceGroup := fmt.Sprintf("acctestRG-psql-%d", rInt) + serverName := fmt.Sprintf("acctest-psql-server-%d", rInt) resp, err := client.Get(ctx, resourceGroup, serverName, configurationName) if err != nil { @@ -188,7 +188,6 @@ func testAccAzureRMPostgreSQLConfiguration_deadlockTimeout(data acceptance.TestD } func testAccAzureRMPostgreSQLConfiguration_template(data acceptance.TestData, name string, value string) string { - server := testAccAzureRMPostgreSQLConfiguration_empty(data) return fmt.Sprintf(` %s @@ -198,18 +197,18 @@ resource "azurerm_postgresql_configuration" "test" { server_name = "${azurerm_postgresql_server.test.name}" value = "%s" } -`, server, name, value) +`, testAccAzureRMPostgreSQLConfiguration_empty(data), name, value) } func testAccAzureRMPostgreSQLConfiguration_empty(data acceptance.TestData) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" + name = "acctestRG-psql-%d" location = "%s" } resource "azurerm_postgresql_server" "test" { - name = "acctestpsqlsvr-%d" + name = "acctest-psql-server-%d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" diff --git a/azurerm/internal/services/postgres/tests/resource_arm_postgresql_database_test.go b/azurerm/internal/services/postgres/tests/resource_arm_postgresql_database_test.go index 944ee16a0e63..88898da9717b 100644 --- a/azurerm/internal/services/postgres/tests/resource_arm_postgresql_database_test.go +++ b/azurerm/internal/services/postgres/tests/resource_arm_postgresql_database_test.go @@ -175,12 +175,12 @@ func testCheckAzureRMPostgreSQLDatabaseDestroy(s *terraform.State) error { func testAccAzureRMPostgreSQLDatabase_basic(data acceptance.TestData) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" + name = "acctestRG-psql-%d" location = "%s" } resource "azurerm_postgresql_server" "test" { - name = "acctestpsqlsvr-%d" + name = "acctest-psql-server-%d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" @@ -199,7 +199,7 @@ resource "azurerm_postgresql_server" "test" { } resource "azurerm_postgresql_database" "test" { - name = "acctestdb_%d" + name = "acctest_PSQL_db_%d" resource_group_name = "${azurerm_resource_group.test.name}" server_name = "${azurerm_postgresql_server.test.name}" charset = "UTF8" @@ -226,12 +226,12 @@ resource "azurerm_postgresql_database" "import" { func testAccAzureRMPostgreSQLDatabase_collationWithHyphen(data acceptance.TestData) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" + name = "acctestRG-psql-%d" location = "%s" } resource "azurerm_postgresql_server" "test" { - name = "acctestpsqlsvr-%d" + name = "acctest-psql-server-%d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" @@ -250,7 +250,7 @@ resource "azurerm_postgresql_server" "test" { } resource "azurerm_postgresql_database" "test" { - name = "acctestdb_%d" + name = "acctest_PSQL_db_%d" resource_group_name = "${azurerm_resource_group.test.name}" server_name = "${azurerm_postgresql_server.test.name}" charset = "UTF8" @@ -262,12 +262,12 @@ resource "azurerm_postgresql_database" "test" { func testAccAzureRMPostgreSQLDatabase_charsetLowercase(data acceptance.TestData) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" + name = "acctestRG-psql-%d" location = "%s" } resource "azurerm_postgresql_server" "test" { - name = "acctestpsqlsvr-%d" + name = "acctest-psql-server-%d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" @@ -286,7 +286,7 @@ resource "azurerm_postgresql_server" "test" { } resource "azurerm_postgresql_database" "test" { - name = "acctestdb_%d" + name = "acctest_PSQL_db_%d" resource_group_name = "${azurerm_resource_group.test.name}" server_name = "${azurerm_postgresql_server.test.name}" charset = "utf8" @@ -298,12 +298,12 @@ resource "azurerm_postgresql_database" "test" { func testAccAzureRMPostgreSQLDatabase_charsetMixedcase(data acceptance.TestData) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" + name = "acctestRG-psql-%d" location = "%s" } resource "azurerm_postgresql_server" "test" { - name = "acctestpsqlsvr-%d" + name = "acctest-psql-server-%d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" @@ -322,7 +322,7 @@ resource "azurerm_postgresql_server" "test" { } resource "azurerm_postgresql_database" "test" { - name = "acctestdb_%d" + name = "acctest_PSQL_db_%d" resource_group_name = "${azurerm_resource_group.test.name}" server_name = "${azurerm_postgresql_server.test.name}" charset = "Utf8" diff --git a/azurerm/internal/services/postgres/tests/resource_arm_postgresql_firewall_rule_test.go b/azurerm/internal/services/postgres/tests/resource_arm_postgresql_firewall_rule_test.go index 3dd5924e51f5..b9aea371992e 100644 --- a/azurerm/internal/services/postgres/tests/resource_arm_postgresql_firewall_rule_test.go +++ b/azurerm/internal/services/postgres/tests/resource_arm_postgresql_firewall_rule_test.go @@ -120,12 +120,12 @@ func testCheckAzureRMPostgreSQLFirewallRuleDestroy(s *terraform.State) error { func testAccAzureRMPostgreSQLFirewallRule_basic(data acceptance.TestData) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" + name = "acctestRG-psql-%d" location = "%s" } resource "azurerm_postgresql_server" "test" { - name = "acctestpsqlsvr-%d" + name = "acctest-psql-server-%d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" @@ -144,7 +144,7 @@ resource "azurerm_postgresql_server" "test" { } resource "azurerm_postgresql_firewall_rule" "test" { - name = "acctestfwrule-%d" + name = "acctest-PSQL-fwrule-%d" resource_group_name = "${azurerm_resource_group.test.name}" server_name = "${azurerm_postgresql_server.test.name}" start_ip_address = "0.0.0.0" diff --git a/azurerm/internal/services/postgres/tests/resource_arm_postgresql_server_test.go b/azurerm/internal/services/postgres/tests/resource_arm_postgresql_server_test.go index cf42eccd3051..a90489d476d8 100644 --- a/azurerm/internal/services/postgres/tests/resource_arm_postgresql_server_test.go +++ b/azurerm/internal/services/postgres/tests/resource_arm_postgresql_server_test.go @@ -355,12 +355,12 @@ func testCheckAzureRMPostgreSQLServerDestroy(s *terraform.State) error { func testAccAzureRMPostgreSQLServer_basic(data acceptance.TestData, version string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" + name = "acctestRG-psql-%d" location = "%s" } resource "azurerm_postgresql_server" "test" { - name = "acctestpsqlsvr-%d" + name = "acctest-psql-server-%d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" @@ -384,12 +384,12 @@ resource "azurerm_postgresql_server" "test" { func testAccAzureRMPostgreSQLServer_basicNinePointFiveOldSku(data acceptance.TestData) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" + name = "acctestRG-psql-%d" location = "%s" } resource "azurerm_postgresql_server" "test" { - name = "acctestpsqlsvr-%d" + name = "acctest-psql-server-%d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" @@ -455,12 +455,12 @@ resource "azurerm_postgresql_server" "import" { func testAccAzureRMPostgreSQLServer_basicNinePointSixUpdatedPassword(data acceptance.TestData) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" + name = "acctestRG-psql-%d" location = "%s" } resource "azurerm_postgresql_server" "test" { - name = "acctestpsqlsvr-%d" + name = "acctest-psql-server-%d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" @@ -483,12 +483,12 @@ resource "azurerm_postgresql_server" "test" { func testAccAzureRMPostgreSQLServer_basicNinePointSixUpdated(data acceptance.TestData) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" + name = "acctestRG-psql-%d" location = "%s" } resource "azurerm_postgresql_server" "test" { - name = "acctestpsqlsvr-%d" + name = "acctest-psql-server-%d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" @@ -511,12 +511,12 @@ resource "azurerm_postgresql_server" "test" { func testAccAzureRMPostgreSQLServer_basicMaxStorage(data acceptance.TestData) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" + name = "acctestRG-psql-%d" location = "%s" } resource "azurerm_postgresql_server" "test" { - name = "acctestpsqlsvr-%d" + name = "acctest-psql-server-%d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" @@ -540,12 +540,12 @@ resource "azurerm_postgresql_server" "test" { func testAccAzureRMPostgreSQLServer_generalPurpose(data acceptance.TestData) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" + name = "acctestRG-psql-%d" location = "%s" } resource "azurerm_postgresql_server" "test" { - name = "acctestpsqlsvr-%d" + name = "acctest-psql-server-%d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" @@ -568,12 +568,12 @@ resource "azurerm_postgresql_server" "test" { func testAccAzureRMPostgreSQLServer_memoryOptimized(data acceptance.TestData) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" + name = "acctestRG-psql-%d" location = "%s" } resource "azurerm_postgresql_server" "test" { - name = "acctestpsqlsvr-%d" + name = "acctest-psql-server-%d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" @@ -596,12 +596,12 @@ resource "azurerm_postgresql_server" "test" { func testAccAzureRMPostgreSQLServer_memoryOptimizedGeoRedundant(data acceptance.TestData) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" + name = "acctestRG-psql-%d" location = "%s" } resource "azurerm_postgresql_server" "test" { - name = "acctestpsqlsvr-%d" + name = "acctest-psql-server-%d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" diff --git a/azurerm/internal/services/postgres/tests/resource_arm_postgresql_virtual_network_rule_test.go b/azurerm/internal/services/postgres/tests/resource_arm_postgresql_virtual_network_rule_test.go index da4328a8c818..bd6410dfa5d2 100644 --- a/azurerm/internal/services/postgres/tests/resource_arm_postgresql_virtual_network_rule_test.go +++ b/azurerm/internal/services/postgres/tests/resource_arm_postgresql_virtual_network_rule_test.go @@ -59,8 +59,8 @@ func TestAccAzureRMPostgreSQLVirtualNetworkRule_switchSubnets(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_postgresql_virtual_network_rule", "test") // Create regex strings that will ensure that one subnet name exists, but not the other - preConfigRegex := regexp.MustCompile(fmt.Sprintf("(subnet1%d)$|(subnet[^2]%d)$", data.RandomInteger, data.RandomInteger)) //subnet 1 but not 2 - postConfigRegex := regexp.MustCompile(fmt.Sprintf("(subnet2%d)$|(subnet[^1]%d)$", data.RandomInteger, data.RandomInteger)) //subnet 2 but not 1 + preConfigRegex := regexp.MustCompile(fmt.Sprintf("(acctest-SN1-%d)$|(acctest-SN[^2]-%d)$", data.RandomInteger, data.RandomInteger)) //subnet 1 but not 2 + postConfigRegex := regexp.MustCompile(fmt.Sprintf("(acctest-SN2-%d)$|(acctest-SN-[^1]%d)$", data.RandomInteger, data.RandomInteger)) //subnet 2 but not 1 resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acceptance.PreCheck(t) }, @@ -240,19 +240,19 @@ func testCheckAzureRMPostgreSQLVirtualNetworkRuleDisappears(resourceName string) func testAccAzureRMPostgreSQLVirtualNetworkRule_basic(data acceptance.TestData) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" + name = "acctestRG-psql-%d" location = "%s" } resource "azurerm_virtual_network" "test" { - name = "acctestvnet%d" + name = "acctest-VNET-%d" address_space = ["10.7.29.0/29"] location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" } resource "azurerm_subnet" "test" { - name = "acctestsubnet%d" + name = "acctest-SN-%d" resource_group_name = "${azurerm_resource_group.test.name}" virtual_network_name = "${azurerm_virtual_network.test.name}" address_prefix = "10.7.29.0/29" @@ -260,7 +260,7 @@ resource "azurerm_subnet" "test" { } resource "azurerm_postgresql_server" "test" { - name = "acctestpostgresqlsvr-%d" + name = "acctest-psql-server-%d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" administrator_login = "acctestun" @@ -278,7 +278,7 @@ resource "azurerm_postgresql_server" "test" { } resource "azurerm_postgresql_virtual_network_rule" "test" { - name = "acctestpostgresqlvnetrule%d" + name = "acctest-PSQL-VNET-rule-%d" resource_group_name = "${azurerm_resource_group.test.name}" server_name = "${azurerm_postgresql_server.test.name}" subnet_id = "${azurerm_subnet.test.id}" @@ -303,19 +303,19 @@ resource "azurerm_postgresql_virtual_network_rule" "import" { func testAccAzureRMPostgreSQLVirtualNetworkRule_subnetSwitchPre(data acceptance.TestData) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" + name = "acctestRG-psql-%d" location = "%s" } resource "azurerm_virtual_network" "test" { - name = "acctestvnet%d" + name = "acctest-VNET-%d" address_space = ["10.7.29.0/24"] location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" } resource "azurerm_subnet" "test1" { - name = "subnet1%d" + name = "acctest-SN1-%d" resource_group_name = "${azurerm_resource_group.test.name}" virtual_network_name = "${azurerm_virtual_network.test.name}" address_prefix = "10.7.29.0/25" @@ -323,7 +323,7 @@ resource "azurerm_subnet" "test1" { } resource "azurerm_subnet" "test2" { - name = "subnet2%d" + name = "acctest-SN2-%d" resource_group_name = "${azurerm_resource_group.test.name}" virtual_network_name = "${azurerm_virtual_network.test.name}" address_prefix = "10.7.29.128/25" @@ -331,7 +331,7 @@ resource "azurerm_subnet" "test2" { } resource "azurerm_postgresql_server" "test" { - name = "acctestpostgresqlsvr-%d" + name = "acctest-psql-server-%d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" administrator_login = "acctestun" @@ -349,7 +349,7 @@ resource "azurerm_postgresql_server" "test" { } resource "azurerm_postgresql_virtual_network_rule" "test" { - name = "acctestpostgresqlvnetrule%d" + name = "acctest-PSQL-VNET-rule-%d" resource_group_name = "${azurerm_resource_group.test.name}" server_name = "${azurerm_postgresql_server.test.name}" subnet_id = "${azurerm_subnet.test1.id}" @@ -360,19 +360,19 @@ resource "azurerm_postgresql_virtual_network_rule" "test" { func testAccAzureRMPostgreSQLVirtualNetworkRule_subnetSwitchPost(data acceptance.TestData) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" + name = "acctestRG-psql-%d" location = "%s" } resource "azurerm_virtual_network" "test" { - name = "acctestvnet%d" + name = "acctest-VNET-%d" address_space = ["10.7.29.0/24"] location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" } resource "azurerm_subnet" "test1" { - name = "subnet1%d" + name = "acctest-SN1-%d" resource_group_name = "${azurerm_resource_group.test.name}" virtual_network_name = "${azurerm_virtual_network.test.name}" address_prefix = "10.7.29.0/25" @@ -380,7 +380,7 @@ resource "azurerm_subnet" "test1" { } resource "azurerm_subnet" "test2" { - name = "subnet2%d" + name = "acctest-SN2-%d" resource_group_name = "${azurerm_resource_group.test.name}" virtual_network_name = "${azurerm_virtual_network.test.name}" address_prefix = "10.7.29.128/25" @@ -388,7 +388,7 @@ resource "azurerm_subnet" "test2" { } resource "azurerm_postgresql_server" "test" { - name = "acctestpostgresqlsvr-%d" + name = "acctest-psql-server-%d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" administrator_login = "acctestun" @@ -406,7 +406,7 @@ resource "azurerm_postgresql_server" "test" { } resource "azurerm_postgresql_virtual_network_rule" "test" { - name = "acctestpostgresqlvnetrule%d" + name = "acctest-PSQL-VNET-rule-%d" resource_group_name = "${azurerm_resource_group.test.name}" server_name = "${azurerm_postgresql_server.test.name}" subnet_id = "${azurerm_subnet.test2.id}" @@ -417,7 +417,7 @@ resource "azurerm_postgresql_virtual_network_rule" "test" { func testAccAzureRMPostgreSQLVirtualNetworkRule_multipleSubnets(data acceptance.TestData) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" + name = "acctestRG-psql-%d" location = "%s" } @@ -460,7 +460,7 @@ resource "azurerm_subnet" "vnet2_subnet1" { } resource "azurerm_postgresql_server" "test" { - name = "acctestpostgresqlsvr-%d" + name = "acctest-psql-server-%d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" administrator_login = "acctestun" @@ -506,19 +506,19 @@ resource "azurerm_postgresql_virtual_network_rule" "rule3" { func testAccAzureRMPostgreSQLVirtualNetworkRule_ignoreEndpointValid(data acceptance.TestData) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" + name = "acctestRG-psql-%d" location = "%s" } resource "azurerm_virtual_network" "test" { - name = "acctestvnet%d" + name = "acctest-VNET-%d" address_space = ["10.7.29.0/29"] location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" } resource "azurerm_subnet" "test" { - name = "acctestsubnet%d" + name = "acctest-SN-%d" resource_group_name = "${azurerm_resource_group.test.name}" virtual_network_name = "${azurerm_virtual_network.test.name}" address_prefix = "10.7.29.0/29"