Skip to content

Commit bcf61d1

Browse files
azurerm_postgresql_* - deprecate PostgreSQL Single Server and its sub resources (hashicorp#29805)
* azurerm_postgresql_* - deprecate PostgreSQL Single Server and its sub resources * deprecate its sub resources * update deprecation messsage * update md file for deprecation message
1 parent 06a61c2 commit bcf61d1

26 files changed

+277
-10
lines changed

internal/services/postgres/postgresql_active_directory_administrator_resource.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ func resourcePostgreSQLAdministrator() *pluginsdk.Resource {
3838
Delete: pluginsdk.DefaultTimeout(30 * time.Minute),
3939
},
4040

41+
DeprecationMessage: "The `azurerm_postgresql_active_directory_administrator` resource is deprecated and will be removed in v5.0 of the AzureRM Provider. Azure Database for PostgreSQL Single Server and its sub resources have been retired as of 2025-03-28, please use the `azurerm_postgresql_flexible_server_active_directory_administrator` resource instead. For more information, see https://techcommunity.microsoft.com/blog/adforpostgresql/retiring-azure-database-for-postgresql-single-server-in-2025/3783783.",
42+
4143
SchemaVersion: 1,
4244
StateUpgraders: pluginsdk.StateUpgrades(map[int]pluginsdk.StateUpgrade{
4345
0: migration.PostgresqlAADAdministratorV0ToV1{},

internal/services/postgres/postgresql_active_directory_administrator_resource_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,18 @@ import (
1212
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
1313
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check"
1414
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
15+
"github.com/hashicorp/terraform-provider-azurerm/internal/features"
1516
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
1617
"github.com/hashicorp/terraform-provider-azurerm/utils"
1718
)
1819

1920
type PostgreSqlAdministratorResource struct{}
2021

2122
func TestAccPostgreSqlAdministrator_basic(t *testing.T) {
23+
if features.FivePointOh() {
24+
t.Skipf("Skipping since `azurerm_postgresql_active_directory_administrator` is deprecated and will be removed in 5.0")
25+
}
26+
2227
data := acceptance.BuildTestData(t, "azurerm_postgresql_active_directory_administrator", "test")
2328
r := PostgreSqlAdministratorResource{}
2429

@@ -42,6 +47,10 @@ func TestAccPostgreSqlAdministrator_basic(t *testing.T) {
4247
}
4348

4449
func TestAccPostgreSqlAdministrator_requiresImport(t *testing.T) {
50+
if features.FivePointOh() {
51+
t.Skipf("Skipping since `azurerm_postgresql_active_directory_administrator` is deprecated and will be removed in 5.0")
52+
}
53+
4554
data := acceptance.BuildTestData(t, "azurerm_postgresql_active_directory_administrator", "test")
4655
r := PostgreSqlAdministratorResource{}
4756

@@ -61,6 +70,10 @@ func TestAccPostgreSqlAdministrator_requiresImport(t *testing.T) {
6170
}
6271

6372
func TestAccPostgreSqlAdministrator_disappears(t *testing.T) {
73+
if features.FivePointOh() {
74+
t.Skipf("Skipping since `azurerm_postgresql_active_directory_administrator` is deprecated and will be removed in 5.0")
75+
}
76+
6477
data := acceptance.BuildTestData(t, "azurerm_postgresql_active_directory_administrator", "test")
6578
r := PostgreSqlAdministratorResource{}
6679

internal/services/postgres/postgresql_configuration_resource.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ func resourcePostgreSQLConfiguration() *pluginsdk.Resource {
3535
Delete: pluginsdk.DefaultTimeout(30 * time.Minute),
3636
},
3737

38+
DeprecationMessage: "The `azurerm_postgresql_configuration` resource is deprecated and will be removed in v5.0 of the AzureRM Provider. Azure Database for PostgreSQL Single Server and its sub resources have been retired as of 2025-03-28, please use the `azurerm_postgresql_flexible_server_configuration` resource instead. For more information, see https://techcommunity.microsoft.com/blog/adforpostgresql/retiring-azure-database-for-postgresql-single-server-in-2025/3783783.",
39+
3840
Schema: map[string]*pluginsdk.Schema{
3941
"name": {
4042
Type: pluginsdk.TypeString,

internal/services/postgres/postgresql_configuration_resource_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,18 @@ import (
1414
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
1515
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check"
1616
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
17+
"github.com/hashicorp/terraform-provider-azurerm/internal/features"
1718
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
1819
"github.com/hashicorp/terraform-provider-azurerm/utils"
1920
)
2021

2122
type PostgreSQLConfigurationResource struct{}
2223

2324
func TestAccPostgreSQLConfiguration_backslashQuote(t *testing.T) {
25+
if features.FivePointOh() {
26+
t.Skipf("Skipping since `azurerm_postgresql_configuration` is deprecated and will be removed in 5.0")
27+
}
28+
2429
data := acceptance.BuildTestData(t, "azurerm_postgresql_configuration", "test")
2530
r := PostgreSQLConfigurationResource{}
2631
data.ResourceTest(t, r, []acceptance.TestStep{
@@ -42,6 +47,10 @@ func TestAccPostgreSQLConfiguration_backslashQuote(t *testing.T) {
4247
}
4348

4449
func TestAccPostgreSQLConfiguration_clientMinMessages(t *testing.T) {
50+
if features.FivePointOh() {
51+
t.Skipf("Skipping since `azurerm_postgresql_configuration` is deprecated and will be removed in 5.0")
52+
}
53+
4554
data := acceptance.BuildTestData(t, "azurerm_postgresql_configuration", "test")
4655
r := PostgreSQLConfigurationResource{}
4756
data.ResourceTest(t, r, []acceptance.TestStep{
@@ -63,6 +72,10 @@ func TestAccPostgreSQLConfiguration_clientMinMessages(t *testing.T) {
6372
}
6473

6574
func TestAccPostgreSQLConfiguration_deadlockTimeout(t *testing.T) {
75+
if features.FivePointOh() {
76+
t.Skipf("Skipping since `azurerm_postgresql_configuration` is deprecated and will be removed in 5.0")
77+
}
78+
6679
data := acceptance.BuildTestData(t, "azurerm_postgresql_configuration", "test")
6780
r := PostgreSQLConfigurationResource{}
6881
data.ResourceTest(t, r, []acceptance.TestStep{
@@ -84,6 +97,10 @@ func TestAccPostgreSQLConfiguration_deadlockTimeout(t *testing.T) {
8497
}
8598

8699
func TestAccPostgreSQLConfiguration_multiplePostgreSQLConfigurations(t *testing.T) {
100+
if features.FivePointOh() {
101+
t.Skipf("Skipping since `azurerm_postgresql_configuration` is deprecated and will be removed in 5.0")
102+
}
103+
87104
data := acceptance.BuildTestData(t, "azurerm_postgresql_configuration", "test")
88105
r := PostgreSQLConfigurationResource{}
89106

internal/services/postgres/postgresql_database_resource.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ func resourcePostgreSQLDatabase() *pluginsdk.Resource {
3737
Delete: pluginsdk.DefaultTimeout(60 * time.Minute),
3838
},
3939

40+
DeprecationMessage: "The `azurerm_postgresql_database` resource is deprecated and will be removed in v5.0 of the AzureRM Provider. Azure Database for PostgreSQL Single Server and its sub resources have been retired as of 2025-03-28, please use the `azurerm_postgresql_flexible_server_database` resource instead. For more information, see https://techcommunity.microsoft.com/blog/adforpostgresql/retiring-azure-database-for-postgresql-single-server-in-2025/3783783.",
41+
4042
SchemaVersion: 1,
4143
StateUpgraders: pluginsdk.StateUpgrades(map[int]pluginsdk.StateUpgrade{
4244
0: migration.PostgresqlDatabaseV0ToV1{},

internal/services/postgres/postgresql_database_resource_test.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,18 @@ import (
1212
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
1313
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check"
1414
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
15+
"github.com/hashicorp/terraform-provider-azurerm/internal/features"
1516
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
1617
"github.com/hashicorp/terraform-provider-azurerm/utils"
1718
)
1819

1920
type PostgreSQLDatabaseResource struct{}
2021

2122
func TestAccPostgreSQLDatabase_basic(t *testing.T) {
23+
if features.FivePointOh() {
24+
t.Skipf("Skipping since `azurerm_postgresql_database` is deprecated and will be removed in 5.0")
25+
}
26+
2227
data := acceptance.BuildTestData(t, "azurerm_postgresql_database", "test")
2328
r := PostgreSQLDatabaseResource{}
2429
data.ResourceTest(t, r, []acceptance.TestStep{
@@ -34,6 +39,10 @@ func TestAccPostgreSQLDatabase_basic(t *testing.T) {
3439
}
3540

3641
func TestAccPostgreSQLDatabase_requiresImport(t *testing.T) {
42+
if features.FivePointOh() {
43+
t.Skipf("Skipping since `azurerm_postgresql_database` is deprecated and will be removed in 5.0")
44+
}
45+
3746
data := acceptance.BuildTestData(t, "azurerm_postgresql_database", "test")
3847
r := PostgreSQLDatabaseResource{}
3948
data.ResourceTest(t, r, []acceptance.TestStep{
@@ -50,6 +59,10 @@ func TestAccPostgreSQLDatabase_requiresImport(t *testing.T) {
5059
}
5160

5261
func TestAccPostgreSQLDatabase_collationWithHyphen(t *testing.T) {
62+
if features.FivePointOh() {
63+
t.Skipf("Skipping since `azurerm_postgresql_database` is deprecated and will be removed in 5.0")
64+
}
65+
5366
data := acceptance.BuildTestData(t, "azurerm_postgresql_database", "test")
5467
r := PostgreSQLDatabaseResource{}
5568
data.ResourceTest(t, r, []acceptance.TestStep{
@@ -65,6 +78,10 @@ func TestAccPostgreSQLDatabase_collationWithHyphen(t *testing.T) {
6578
}
6679

6780
func TestAccPostgreSQLDatabase_charsetLowercase(t *testing.T) {
81+
if features.FivePointOh() {
82+
t.Skipf("Skipping since `azurerm_postgresql_database` is deprecated and will be removed in 5.0")
83+
}
84+
6885
data := acceptance.BuildTestData(t, "azurerm_postgresql_database", "test")
6986
r := PostgreSQLDatabaseResource{}
7087
data.ResourceTest(t, r, []acceptance.TestStep{
@@ -80,6 +97,10 @@ func TestAccPostgreSQLDatabase_charsetLowercase(t *testing.T) {
8097
}
8198

8299
func TestAccPostgreSQLDatabase_charsetMixedcase(t *testing.T) {
100+
if features.FivePointOh() {
101+
t.Skipf("Skipping since `azurerm_postgresql_database` is deprecated and will be removed in 5.0")
102+
}
103+
83104
data := acceptance.BuildTestData(t, "azurerm_postgresql_database", "test")
84105
r := PostgreSQLDatabaseResource{}
85106
data.ResourceTest(t, r, []acceptance.TestStep{

internal/services/postgres/postgresql_firewall_rule_resource.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ func resourcePostgreSQLFirewallRule() *pluginsdk.Resource {
3636
Delete: pluginsdk.DefaultTimeout(30 * time.Minute),
3737
},
3838

39+
DeprecationMessage: "The `azurerm_postgresql_firewall_rule` resource is deprecated and will be removed in v5.0 of the AzureRM Provider. Azure Database for PostgreSQL Single Server and its sub resources have been retired as of 2025-03-28, please use the `azurerm_postgresql_flexible_server_firewall_rule` resource instead. For more information, see https://techcommunity.microsoft.com/blog/adforpostgresql/retiring-azure-database-for-postgresql-single-server-in-2025/3783783.",
40+
3941
Schema: map[string]*pluginsdk.Schema{
4042
"name": {
4143
Type: pluginsdk.TypeString,

internal/services/postgres/postgresql_firewall_rule_resource_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,18 @@ import (
1212
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
1313
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check"
1414
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
15+
"github.com/hashicorp/terraform-provider-azurerm/internal/features"
1516
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
1617
"github.com/hashicorp/terraform-provider-azurerm/utils"
1718
)
1819

1920
type PostgreSQLFirewallRuleResource struct{}
2021

2122
func TestAccPostgreSQLFirewallRule_basic(t *testing.T) {
23+
if features.FivePointOh() {
24+
t.Skipf("Skipping since `azurerm_postgresql_firewall_rule` is deprecated and will be removed in 5.0")
25+
}
26+
2227
data := acceptance.BuildTestData(t, "azurerm_postgresql_firewall_rule", "test")
2328
r := PostgreSQLFirewallRuleResource{}
2429
data.ResourceTest(t, r, []acceptance.TestStep{
@@ -35,6 +40,10 @@ func TestAccPostgreSQLFirewallRule_basic(t *testing.T) {
3540
}
3641

3742
func TestAccPostgreSQLFirewallRule_requiresImport(t *testing.T) {
43+
if features.FivePointOh() {
44+
t.Skipf("Skipping since `azurerm_postgresql_firewall_rule` is deprecated and will be removed in 5.0")
45+
}
46+
3847
data := acceptance.BuildTestData(t, "azurerm_postgresql_firewall_rule", "test")
3948
r := PostgreSQLFirewallRuleResource{}
4049
data.ResourceTest(t, r, []acceptance.TestStep{

internal/services/postgres/postgresql_server_data_source.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ func dataSourcePostgreSqlServer() *pluginsdk.Resource {
2727
Read: pluginsdk.DefaultTimeout(10 * time.Minute),
2828
},
2929

30+
DeprecationMessage: "The `azurerm_postgresql_server` data source is deprecated and will be removed in v5.0 of the AzureRM Provider. Azure Database for PostgreSQL Single Server and its sub resources have been retired as of 2025-03-28, please use the `azurerm_postgresql_flexible_server` data source instead. For more information, see https://techcommunity.microsoft.com/blog/adforpostgresql/retiring-azure-database-for-postgresql-single-server-in-2025/3783783.",
31+
3032
Schema: map[string]*pluginsdk.Schema{
3133
"name": {
3234
Type: pluginsdk.TypeString,

internal/services/postgres/postgresql_server_data_source_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,16 @@ import (
99

1010
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
1111
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check"
12+
"github.com/hashicorp/terraform-provider-azurerm/internal/features"
1213
)
1314

1415
type PostgreSQLServerDataSource struct{}
1516

1617
func TestAccDataSourcePostgreSqlServer_basic(t *testing.T) {
18+
if features.FivePointOh() {
19+
t.Skipf("Skipping since `azurerm_postgresql_server` is deprecated and will be removed in 5.0")
20+
}
21+
1722
data := acceptance.BuildTestData(t, "data.azurerm_postgresql_server", "test")
1823
r := PostgreSQLServerDataSource{}
1924
version := "9.5"

0 commit comments

Comments
 (0)