-
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
Feature Request: automatically generate UUID for azurerm_role_definition #1371
Comments
Hello @JamesDLD, Thank you for the suggestion! I have opened #1378 that should address it 🙂 However until it gets merged and released, you could use the random provider to generate and persist a UUID in terraform: data "azurerm_subscription" "primary" {}
resource "random_id" "server" {
byte_length = 16
}
resource "azurerm_role_definition" "roles" {
role_definition_id = "${random_id.server.hex}"
name = "MyRoleDefinitionWithAnUniqueName"
scope = "${data.azurerm_subscription.primary.id}"
permissions {
actions = ["*"]
not_actions = [
"Microsoft.Authorization/*/Delete",
"Microsoft.Authorization/*/Write",
"Microsoft.Authorization/elevateAccess/Action",
]
}
assignable_scopes = [
"${data.azurerm_subscription.primary.id}",
]
} |
Excellent @katbyte ! Thank you! |
Hey @JamesDLD, This is now in master and has been released in 1.7 so you should be able to drop the terraform bits and rely entirely on the prover to generate the UUID. |
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks! |
Community Note
Description
Could we make the variable role_definition_id of the resource "azurerm_role_definition" optional?
Work has been done for the resource "azurerm_role_assignment" here #667
Same concern, below quoted ==>
"I don't understand why I need to specify a unique UUID for a azurerm_role_assignment resource. This makes this piece of code less modular. Would it be possible to make this property optional and fall back to an automatically generated UUID? Or is there any way to generate a static UUID in terraform? When I use the ${uuid()} interpolation, terraform will recreate the azurerm_role_assignment each run because the interpolation has changed."
New or Affected Resource(s)
Terraform v0.11.7
provider.azurerm v1.6.0
Potential Terraform Configuration
References
The text was updated successfully, but these errors were encountered: