-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
azurerm_pim_eligible_role_assignment
creates assignment but fails with couldn't find resource
#23366
Comments
I think I've found the cause of the issue, basically it's the scope of the role definition. In the example above I don't specify the scope of the role when I look it up which gives me the following ID: Because of this, this search never matches: for _, item := range items.Items {
if *item.Properties.RoleDefinitionId == roleDefinitionId &&
*item.Properties.MemberType == roleeligibilityscheduleinstances.MemberTypeDirect {
state = "Found"
result = item
}
} Adding 'scope' to my role lookup resolves the issue. The for loop above could also be adjusted to only check the role ID's GUID as it's already searching at the correct scope |
@alexwilcox9 Thanks for digging into that, that's super helpful 👍 |
@manicminer can we get a fix for this? I'm having the same issues since Aug #22909 |
I see the same behaviour with azurerm_pim_active_role_assignment resources (azurerm provider 3.75.0) |
I had this problem with a scope at the resource group level. resource "azurerm_pim_eligible_role_assignment" "project_owner" {
scope = azurerm_resource_group.main.id
role_definition_id = "${data.azurerm_subscription.primary.id}${data.azurerm_role_definition.owner.id}"
# these don't work
# role_definition_id = data.azurerm_role_definition.owner.role_definition_id
# role_definition_id = "${azurerm_resource_group.main.id}${data.azurerm_role_definition.owner.id}" |
This is a bug. The role assignment in pending status will never be get as the right API is not used. There are two API: schedule and instance, the API currently used by AzureRM can only get activated role assignments. |
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. |
Is there an existing issue for this?
Community Note
Terraform Version
1.5.7
AzureRM Provider Version
3.74.0
Affected Resource(s)/Data Source(s)
azurerm_pim_eligible_role_assignment
Terraform Configuration Files
Debug Output/Panic Output
Expected Behaviour
The PIM assignment should be created and Terraform complete successfully
Actual Behaviour
The PIM assignment is created but Terraform fails to detect this and errors after about seven minutes.
If you run a second apply it errors as the assignment already exists
Steps to Reproduce
terraform apply
Important Factoids
No response
References
No response
The text was updated successfully, but these errors were encountered: