From 3870172d88b46c0073da71db9c1421154b740f23 Mon Sep 17 00:00:00 2001
From: sarna
Date: Mon, 28 Oct 2024 06:16:48 +0530
Subject: [PATCH] `azurerm_nginx_deployment`: Deprecate
`managed_resource_group` field
This field was deprecated by the service provider
a long time back. This commit just deprectes the
same field in terrform in the next provider
version.
---
.../nginx/nginx_deployment_data_source.go | 18 +++++++++-------
.../nginx/nginx_deployment_resource.go | 21 ++++++++++---------
2 files changed, 22 insertions(+), 17 deletions(-)
diff --git a/internal/services/nginx/nginx_deployment_data_source.go b/internal/services/nginx/nginx_deployment_data_source.go
index cdfa5968041f..7533a319eae8 100644
--- a/internal/services/nginx/nginx_deployment_data_source.go
+++ b/internal/services/nginx/nginx_deployment_data_source.go
@@ -13,6 +13,7 @@ import (
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/go-azure-helpers/resourcemanager/identity"
"github.com/hashicorp/go-azure-sdk/resource-manager/nginx/2024-09-01-preview/nginxdeployment"
+ "github.com/hashicorp/terraform-provider-azurerm/internal/features"
"github.com/hashicorp/terraform-provider-azurerm/internal/sdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation"
@@ -56,7 +57,7 @@ func (m DeploymentDataSource) Arguments() map[string]*pluginsdk.Schema {
}
func (m DeploymentDataSource) Attributes() map[string]*pluginsdk.Schema {
- return map[string]*pluginsdk.Schema{
+ dataSource := map[string]*pluginsdk.Schema{
"nginx_version": {
Type: pluginsdk.TypeString,
Computed: true,
@@ -69,11 +70,6 @@ func (m DeploymentDataSource) Attributes() map[string]*pluginsdk.Schema {
Computed: true,
},
- "managed_resource_group": {
- Type: pluginsdk.TypeString,
- Computed: true,
- },
-
"location": commonschema.LocationComputed(),
"capacity": {
@@ -196,6 +192,15 @@ func (m DeploymentDataSource) Attributes() map[string]*pluginsdk.Schema {
"tags": commonschema.TagsDataSource(),
}
+
+ if !features.FivePointOhBeta() {
+ dataSource["managed_resource_group"] = &pluginsdk.Schema{
+ Deprecated: "The `managed_resource_group` field has been deprecated and will be removed in v5.0 of the AzureRM Provider.",
+ Type: pluginsdk.TypeString,
+ Computed: true,
+ }
+ }
+ return dataSource
}
func (m DeploymentDataSource) ModelObject() interface{} {
@@ -245,7 +250,6 @@ func (m DeploymentDataSource) Read() sdk.ResourceFunc {
output.Identity = *flattenedIdentity
if props := model.Properties; props != nil {
output.IpAddress = pointer.ToString(props.IPAddress)
- output.ManagedResourceGroup = pointer.ToString(props.ManagedResourceGroup)
output.NginxVersion = pointer.ToString(props.NginxVersion)
output.DiagnoseSupportEnabled = pointer.ToBool(props.EnableDiagnosticsSupport)
diff --git a/internal/services/nginx/nginx_deployment_resource.go b/internal/services/nginx/nginx_deployment_resource.go
index 7688e5fd44db..23a51536f592 100644
--- a/internal/services/nginx/nginx_deployment_resource.go
+++ b/internal/services/nginx/nginx_deployment_resource.go
@@ -111,14 +111,6 @@ func (m DeploymentResource) Arguments() map[string]*pluginsdk.Schema {
"identity": commonschema.SystemAssignedUserAssignedIdentityOptional(),
- "managed_resource_group": {
- Type: pluginsdk.TypeString,
- Optional: true,
- Computed: true,
- ForceNew: true,
- ValidateFunc: validation.StringIsNotEmpty,
- },
-
"location": commonschema.Location(),
"capacity": {
@@ -336,6 +328,17 @@ func (m DeploymentResource) Arguments() map[string]*pluginsdk.Schema {
}
}
+ if !features.FivePointOhBeta() {
+ resource["managed_resource_group"] = &pluginsdk.Schema{
+ Deprecated: "The `managed_resource_group` field has been deprecated and will be removed in v5.0 of the AzureRM Provider.",
+ Type: pluginsdk.TypeString,
+ Optional: true,
+ Computed: true,
+ ForceNew: true,
+ ValidateFunc: validation.StringIsNotEmpty,
+ }
+ }
+
return resource
}
@@ -394,7 +397,6 @@ func (m DeploymentResource) Create() sdk.ResourceFunc {
}
prop := &nginxdeployment.NginxDeploymentProperties{}
- prop.ManagedResourceGroup = pointer.FromString(model.ManagedResourceGroup)
if len(model.LoggingStorageAccount) > 0 {
prop.Logging = &nginxdeployment.NginxLogging{
@@ -557,7 +559,6 @@ func (m DeploymentResource) Read() sdk.ResourceFunc {
if props := model.Properties; props != nil {
output.IpAddress = pointer.ToString(props.IPAddress)
- output.ManagedResourceGroup = pointer.ToString(props.ManagedResourceGroup)
output.NginxVersion = pointer.ToString(props.NginxVersion)
output.DiagnoseSupportEnabled = pointer.ToBool(props.EnableDiagnosticsSupport)