{"id":19852518,"url":"https://github.com/thesoftwarehouse/terraform-azurerm-role-assignment","last_synced_at":"2026-04-19T05:33:32.369Z","repository":{"id":263620058,"uuid":"830968852","full_name":"TheSoftwareHouse/terraform-azurerm-role-assignment","owner":"TheSoftwareHouse","description":"Terraform Module to assign Azure IAM roles","archived":false,"fork":false,"pushed_at":"2024-11-14T14:52:46.000Z","size":37,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-10-24T10:47:56.891Z","etag":null,"topics":["azure","azurerm","role-assignment","terraform","tsh"],"latest_commit_sha":null,"homepage":"","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TheSoftwareHouse.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-19T11:08:30.000Z","updated_at":"2024-11-15T08:33:24.000Z","dependencies_parsed_at":"2024-11-26T00:00:14.491Z","dependency_job_id":null,"html_url":"https://github.com/TheSoftwareHouse/terraform-azurerm-role-assignment","commit_stats":null,"previous_names":["thesoftwarehouse/terraform-azurerm-role-assignment"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/TheSoftwareHouse/terraform-azurerm-role-assignment","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheSoftwareHouse%2Fterraform-azurerm-role-assignment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheSoftwareHouse%2Fterraform-azurerm-role-assignment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheSoftwareHouse%2Fterraform-azurerm-role-assignment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheSoftwareHouse%2Fterraform-azurerm-role-assignment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheSoftwareHouse","download_url":"https://codeload.github.com/TheSoftwareHouse/terraform-azurerm-role-assignment/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheSoftwareHouse%2Fterraform-azurerm-role-assignment/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31996441,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"online","status_checked_at":"2026-04-19T02:00:07.110Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["azure","azurerm","role-assignment","terraform","tsh"],"created_at":"2024-11-12T14:03:14.884Z","updated_at":"2026-04-19T05:33:32.331Z","avatar_url":"https://github.com/TheSoftwareHouse.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# terraform-role-assignment\n\n## Assign roles to users, groups and service principals\n\nThis Terraform module assigns `BUILT IN` roles to users, groups and service principals.\n\n## Usage\nNOTE: Assigning the same role to the same user, group or service principal multiple times will merge it, so when you do:\n```hcl\nmodule \"role_assignments\" {\n  source = \"retoxx-dev/role-assignment/azurerm\"\n\n  role_assignments = [\n    {\n      user_principal_names = [\"user1@contoso.com\"]\n      role_names           = [\"Reader\", \"Web Plan Contributor\"]\n      scope                = azurerm_resource_group.this.id\n    },\n    {\n      user_principal_names = [\"user1@contoso.com\", \"user2@contoso.com\"]\n      role_names           = [\"Reader\", \"Owner\"]\n      scope                = azurerm_resource_group.this.id\n    }\n  ]\n}\n```\nThe role `Reader` will be assigned to `user1@contoso.com` only once.\n\n### Assign roles to users\n```hcl\nmodule \"role_assignments\" {\n  source = \"retoxx-dev/role-assignment/azurerm\"\n\n  role_assignments = [\n    {\n      user_principal_names = [\"user1@contoso.com\", \"user2@contoso.com\"]\n      role_names           = [\"Reader\", \"Web Plan Contributor\"]\n      scope                = azurerm_resource_group.this.id\n    }\n  ]\n}\n```\n\n### Assign roles to groups\n```hcl\nmodule \"role_assignments\" {\n  source = \"retoxx-dev/role-assignment/azurerm\"\n\n  role_assignments = [\n    {\n      group_names = [\"group1\", \"group2\", \"group3\"]\n      role_names  = [\"Reader\", \"Web Plan Contributor\"]\n      scope       = azurerm_resource_group.this.id\n    }\n  ]\n}\n```\n\n### Assign roles to service principals\n```hcl\nmodule \"role_assignments\" {\n  source = \"retoxx-dev/role-assignment/azurerm\"\n\n  role_assignments = [\n    {\n      sp_names   = [\"spname1\", \"spname2\", \"spname3\"]\n      role_names = [\"Reader\", \"Web Plan Contributor\"]\n      scope      = azurerm_resource_group.this.id\n    }\n  ]\n}\n```\n\n### Assign roles to service principals but with principal ids\n```hcl\nmodule \"role_assignments\" {\n  source = \"retoxx-dev/role-assignment/azurerm\"\n\n  role_assignments = [\n    {\n      principal_ids   = [\"00000000-0000-0000-0000-000000000000\"]\n      role_names      = [\"Reader\", \"Web Plan Contributor\"]\n      scope           = azurerm_resource_group.this.id\n    }\n  ]\n}\n```\n\n\u003c!-- BEGIN_TF_DOCS --\u003e\n## Requirements\n\n| Name | Version |\n|------|---------|\n| \u003ca name=\"requirement_terraform\"\u003e\u003c/a\u003e [terraform](#requirement\\_terraform) | \u003e= 1.3.1 |\n| \u003ca name=\"requirement_azuread\"\u003e\u003c/a\u003e [azuread](#requirement\\_azuread) | \u003e=2.37 |\n| \u003ca name=\"requirement_azurerm\"\u003e\u003c/a\u003e [azurerm](#requirement\\_azurerm) | \u003e=3.33 |\n\n## Providers\n\n| Name | Version |\n|------|---------|\n| \u003ca name=\"provider_azuread\"\u003e\u003c/a\u003e [azuread](#provider\\_azuread) | \u003e=2.37 |\n| \u003ca name=\"provider_azurerm\"\u003e\u003c/a\u003e [azurerm](#provider\\_azurerm) | \u003e=3.33 |\n\n## Modules\n\nNo modules.\n\n## Resources\n\n| Name | Type |\n|------|------|\n| [azurerm_role_assignment.groups](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/role_assignment) | resource |\n| [azurerm_role_assignment.principal_ids](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/role_assignment) | resource |\n| [azurerm_role_assignment.service_principals](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/role_assignment) | resource |\n| [azurerm_role_assignment.users](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/role_assignment) | resource |\n| [azuread_group.group_objects](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/group) | data source |\n| [azuread_service_principal.sp_objects](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/service_principal) | data source |\n| [azuread_user.user_objects](https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/data-sources/user) | data source |\n\n## Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|------|---------|:--------:|\n| \u003ca name=\"input_role_assignments\"\u003e\u003c/a\u003e [role\\_assignments](#input\\_role\\_assignments) | The role assignments to create | \u003cpre\u003elist(object({\u003cbr\u003e    user_principal_names = optional(list(string), [])\u003cbr\u003e    group_names          = optional(list(string), [])\u003cbr\u003e    sp_names             = optional(list(string), [])\u003cbr\u003e    principal_ids        = optional(list(string), [])\u003cbr\u003e    role_names           = list(string)\u003cbr\u003e    scope                = string\u003cbr\u003e  }))\u003c/pre\u003e | n/a | yes |\n\n## Outputs\n\nNo outputs.\n\u003c!-- END_TF_DOCS --\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthesoftwarehouse%2Fterraform-azurerm-role-assignment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthesoftwarehouse%2Fterraform-azurerm-role-assignment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthesoftwarehouse%2Fterraform-azurerm-role-assignment/lists"}