-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ec039a7
commit 19ef740
Showing
11 changed files
with
83 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,16 +10,16 @@ NOTE: Assigning the same role to the same user, group or service principal multi | |
module "role_assignments" { | ||
source = "retoxx-dev/role-assignment/azurerm" | ||
scope = azurerm_resource_group.this.id | ||
role_assignments = [ | ||
{ | ||
user_principal_names = ["[email protected]"] | ||
role_names = ["Reader", "Web Plan Contributor"] | ||
scope = azurerm_resource_group.this.id | ||
}, | ||
{ | ||
user_principal_names = ["[email protected]", "[email protected]"] | ||
role_names = ["Reader", "Owner"] | ||
scope = azurerm_resource_group.this.id | ||
} | ||
] | ||
} | ||
|
@@ -31,12 +31,11 @@ The role `Reader` will be assigned to `[email protected]` only once. | |
module "role_assignments" { | ||
source = "retoxx-dev/role-assignment/azurerm" | ||
scope = azurerm_resource_group.this.id | ||
role_assignments = [ | ||
{ | ||
user_principal_names = ["[email protected]", "[email protected]"] | ||
role_names = ["Reader", "Web Plan Contributor"] | ||
scope = azurerm_resource_group.this.id | ||
} | ||
] | ||
} | ||
|
@@ -47,12 +46,11 @@ module "role_assignments" { | |
module "role_assignments" { | ||
source = "retoxx-dev/role-assignment/azurerm" | ||
scope = azurerm_resource_group.this.id | ||
role_assignments = [ | ||
{ | ||
group_names = ["group1", "group2", "group3"] | ||
role_names = ["Reader", "Web Plan Contributor"] | ||
scope = azurerm_resource_group.this.id | ||
} | ||
] | ||
} | ||
|
@@ -63,12 +61,11 @@ module "role_assignments" { | |
module "role_assignments" { | ||
source = "retoxx-dev/role-assignment/azurerm" | ||
scope = azurerm_resource_group.this.id | ||
role_assignments = [ | ||
{ | ||
sp_names = ["spname1", "spname2", "spname3"] | ||
role_names = ["Reader", "Web Plan Contributor"] | ||
scope = azurerm_resource_group.this.id | ||
} | ||
] | ||
} | ||
|
@@ -81,9 +78,9 @@ module "role_assignments" { | |
role_assignments = [ | ||
{ | ||
scope = azurerm_resource_group.this.id | ||
principal_ids = ["spname1", "spname2", "spname3"] | ||
principal_ids = ["00000000-0000-0000-0000-000000000000"] | ||
role_names = ["Reader", "Web Plan Contributor"] | ||
scope = azurerm_resource_group.this.id | ||
} | ||
] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Azure Role Assignment Module | ||
|
||
Terraform module that assigns `BUILT IN` IAM roles to groups, service principals and users. | ||
|
||
## Usage | ||
|
||
```hcl | ||
# Configure the Azure provider | ||
provider "azurerm" { | ||
features {} | ||
} | ||
# Create a resource group to reference it in the role assignments module | ||
resource "azurerm_resource_group" "this" { | ||
name = "rg-terraform-northeu-001" | ||
location = "northeurope" | ||
} | ||
# Use the role assignments module to assign roles to users | ||
module "role_assignments" { | ||
source = "retoxx-dev/role-assignment/azurerm" | ||
role_assignments = [ | ||
{ | ||
scope = azurerm_resource_group.this.id | ||
user_principal_names = ["[email protected]", "[email protected]"] | ||
role_names = ["Reader", "Web Plan Contributor"] | ||
} | ||
] | ||
} | ||
``` | ||
|
||
## Terraform | ||
|
||
To run this example you need to execute: | ||
|
||
```bash | ||
terraform init | ||
terraform plan | ||
terraform apply | ||
``` | ||
|
||
You can destroy created resources with `terraform destroy`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
provider "azurerm" { | ||
features {} | ||
} | ||
|
||
resource "azurerm_resource_group" "this" { | ||
name = "rg-terraform-northeu-001" | ||
location = "northeurope" | ||
} | ||
|
||
resource "azurerm_user_assigned_identity" "this" { | ||
name = "terraform-identity-001" | ||
resource_group_name = azurerm_resource_group.this.name | ||
location = azurerm_resource_group.this.location | ||
} | ||
|
||
module "role_assignments" { | ||
source = "retoxx-dev/role-assignment/azurerm" | ||
|
||
role_assignments = [ | ||
{ | ||
scope = azurerm_resource_group.this.id | ||
principal_ids = [azurerm_user_assigned_identity.this.principal_id] | ||
role_names = ["Reader", "Web Plan Contributor"] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters