Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecation of management_group_name in azurerm_policy_definition and azurerm_policy_set_definition #15209

Merged
merged 3 commits into from
Feb 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions internal/services/policy/policy_definition_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,22 @@ func resourceArmPolicyDefinition() *pluginsdk.Resource {
),
},

// TODO: deprecate Name in favour of this
"management_group_id": {
Type: pluginsdk.TypeString,
Optional: true,
ForceNew: true,
Computed: true,
Computed: true, // TODO 3.0 - remove this when deprecation resolves
ConflictsWith: []string{"management_group_name"},
Deprecated: "Deprecated in favour of `management_group_name`", // TODO -- remove this in next major version
},

// TODO 3.0 - Remove this
"management_group_name": {
Type: pluginsdk.TypeString,
Optional: true,
ForceNew: true,
Computed: true, // TODO -- remove this when deprecation resolves
Computed: true,
ConflictsWith: []string{"management_group_id"},
Deprecated: "Deprecated in favour of `management_group_id`",
},

"display_name": {
Expand Down
7 changes: 4 additions & 3 deletions internal/services/policy/policy_set_definition_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,18 @@ func resourceArmPolicySetDefinition() *pluginsdk.Resource {
Type: pluginsdk.TypeString,
Optional: true,
ForceNew: true,
Computed: true,
Computed: true, // TODO 3.0 - remove this when deprecation resolves
ConflictsWith: []string{"management_group_name"},
Deprecated: "Deprecated in favour of `management_group_name`", // TODO -- remove this in next major version
},

// TODO 3.0 - Remove this
"management_group_name": {
Type: pluginsdk.TypeString,
Optional: true,
ForceNew: true,
Computed: true, // TODO -- remove this when deprecation resolves
Computed: true,
ConflictsWith: []string{"management_group_id"},
Deprecated: "Deprecated in favour of `management_group_name`",
},

"display_name": {
Expand Down
4 changes: 2 additions & 2 deletions website/docs/r/policy_definition.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ The following arguments are supported:

* `description` - (Optional) The description of the policy definition.

* `management_group_name` - (Optional) The name of the Management Group where this policy should be defined. Changing this forces a new resource to be created.
* `management_group_name` - (Optional / **Deprecated in favour of `management_group_id`**) The name of the Management Group where this policy should be defined. Changing this forces a new resource to be created.

* `management_group_id` - (Optional / **Deprecated in favour of `management_group_name`**) The name of the Management Group where this policy should be defined. Changing this forces a new resource to be created.
* `management_group_id` - (Optional) The name of the Management Group where this policy should be defined. Changing this forces a new resource to be created.

~> **Note:** if you are using `azurerm_management_group` to assign a value to `management_group_id`, be sure to use `name` or `group_id` attribute, but not `id`.

Expand Down
4 changes: 2 additions & 2 deletions website/docs/r/policy_set_definition.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ The following arguments are supported:

* `description` - (Optional) The description of the policy set definition.

* `management_group_name` - (Optional) The name of the Management Group where this policy set definition should be defined. Changing this forces a new resource to be created.
* `management_group_name` - (Optional / **Deprecated in favour of `management_group_id`**) The name of the Management Group where this policy set definition should be defined. Changing this forces a new resource to be created.

* `management_group_id` - (Optional / **Deprecated in favour of `management_group_name`**) The name of the Management Group where this policy set definition should be defined. Changing this forces a new resource to be created.
* `management_group_id` - (Optional) The name of the Management Group where this policy set definition should be defined. Changing this forces a new resource to be created.

~> **NOTE:** if you are using `azurerm_management_group` to assign a value to `management_group_id`, be sure to use `name` or `group_id` attribute, but not `id`.

Expand Down