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

Policy Exemption should be recreated instead of updated when assignment changes #19667

Closed
1 task done
freeman opened this issue Dec 13, 2022 · 1 comment · Fixed by #19674
Closed
1 task done

Policy Exemption should be recreated instead of updated when assignment changes #19667

freeman opened this issue Dec 13, 2022 · 1 comment · Fixed by #19674
Labels

Comments

@freeman
Copy link
Contributor

freeman commented Dec 13, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

1.3.5

AzureRM Provider Version

3.32.0

Affected Resource(s)/Data Source(s)

azurerm_resource_policy_exemption, azurerm_resource_group_policy_exemption, azurerm_subscription_policy_exemption

Terraform Configuration Files

resource "azurerm_resource_policy_exemption" "myexemption" {
  name                 = "myexemption"
  display_name         = "Bypass for this resource"
  exemption_category   = "Waiver"
  policy_assignment_id = data.azurerm_policy_assignment.mypolicyassignment.id
  resource_id          = "/resourceId"
}

Debug Output/Panic Output

N/A

Expected Behaviour

Exemption should be recreated instead of being updated when the assignment changes.

If think making policy_assignment_id as ForceNew should not be a problem.

Actual Behaviour

Provider tried to update the exemption and Azure API prevents it (at least when the assignment has been deleted (and then recreated with a different id)) with this kind of error:

policy.ExemptionsClient#CreateOrUpdate: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="InvalidPolicyAssignmentIdUpdate" Message="The policy exemption 'myexemption' update request is invalid. Cannot update the existing policy exemption's policy assignment 'previousAssignmentId' with new policy assignment 'newAssignmentId'."

Steps to Reproduce

N/A

Important Factoids

No response

References

No response

@freeman freeman added the bug label Dec 13, 2022
@github-actions github-actions bot removed the bug label Dec 13, 2022
katbyte pushed a commit that referenced this issue Dec 15, 2022
…ption/azurerm_subscription_policy_exemption` - Mark `policy_assignment_id` as ForceNew (#19674)

fixes #19667
favoretti pushed a commit to favoretti/terraform-provider-azurerm that referenced this issue Jan 12, 2023
…ption/azurerm_subscription_policy_exemption` - Mark `policy_assignment_id` as ForceNew (hashicorp#19674)

fixes hashicorp#19667
@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
2 participants