Open derbl4ck opened 1 month ago
The role assignment you've created is valid, it's just not the one you expected or required for your use case.
As long as the role definition is available at the given (valid) scope, you can assign it, otherwise the API will throw.
To assist the practitioner here, we would need to do sanity checks on the provider side, which is probably out of scope as this has to be hard-coded, example:
Billing reader does not make sense on /providers/Microsoft.Foo, therefore throw an error during plan.
Is there an existing issue for this?
Community Note
Terraform Version
1.9.5
AzureRM Provider Version
4.6.0
Affected Resource(s)/Data Source(s)
azurerm_role_assignment
Terraform Configuration Files
Debug Output/Panic Output
Expected Behaviour
If an invalid scope is provided, or ARM API did not create an role assignment, there should be a sufficient error message.
Actual Behaviour
The ID attribute of the azurerm_subscription resource and data source should match. Due to a change mentioned in #22919 the ID of the azurerm_subscription resource now is equal to "/providers/Microsoft.Subscription/aliases/12341234-1234-1234-1234-123412341234" instead of "/subscriptions/12341234-1234-1234-1234-123412341234". While using this as scope for the azurerm_role_assignment resource, there is no error thrown in the terraform output. If you navigate to the Azure Portal or Check it via ARM API, you can verify that no role assignment was created. We should add a sufficient error message if a scope of this scheme is provided.
Steps to Reproduce
Important Factoids
No response
References
22919