terraform-provider-azuread
terraform-provider-azuread copied to clipboard
Add more fine grained assignment durations to azuread_access_package_assignment_policy
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritise this request
- Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritise the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Description
Right now it is only possible to choose for a duration_in_days which only allows for a whole number. We would like to set the assignment duration to be in hours, for example 2 hours
New or Affected Resource(s)
azuread_access_package_assignment_policy
Potential Terraform Configuration
resource "azuread_access_package" "access_package" {
display_name = "DisplayName"
description = "Description"
catalog_id = data.azuread_access_package_catalog.catalog.id
}
resource "azuread_access_package_assignment_policy" "assignment_policy" {
access_package_id = azuread_access_package.access_package.id
display_name = "DisplayName"
description = "Description"
duration_in_hours = 2
requestor_settings {
scope_type = "SpecificDirectorySubjects"
requestor {
backup = false
object_id = "ObjectID"
subject_type = "groupMembers"
}
}
approval_settings {
approval_required = false
}
}```
### References
* https://learn.microsoft.com/en-us/graph/api/entitlementmanagement-post-assignmentpolicies?view=graph-rest-1.0&tabs=http
Considering the API's format and the possibility to define the duration in a more granular manner (e.g., hours), we could change the duration_in_days attribute to duration which will accept the duration in ISO 8601 format.
In this way, it would be possible to set duration in days, hours, minutes, or even seconds. For example, if you want to set the duration to 2 hours, you would use "PT2H".
The potential Terraform Configuration would look like this:
resource "azuread_access_package" "access_package" {
display_name = "DisplayName"
description = "Description"
catalog_id = data.azuread_access_package_catalog.catalog.id
}
resource "azuread_access_package_assignment_policy" "assignment_policy" {
access_package_id = azuread_access_package.access_package.id
display_name = "DisplayName"
description = "Description"
duration = "PT2H"
requestor_settings {
scope_type = "SpecificDirectorySubjects"
requestor {
backup = false
object_id = "ObjectID"
subject_type = "groupMembers"
}
}
approval_settings {
approval_required = false
}
}
This would align the Terraform provider more closely with the Microsoft Graph API and provide the flexibility for defining the duration in a more fine-grained manner.
I agree on using ISO 8601 this would align it with the the current Microsoft Graph setup.
Do we have any update on it?
bump on this
Still open ??