-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* (GH-919) Update role permission and permissions documentation * resolved issues
- Loading branch information
1 parent
525eba1
commit 236d388
Showing
6 changed files
with
191 additions
and
1 deletion.
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
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,6 @@ | ||
# This resource can be imported by specifying the | ||
# role ID, resource identifier, and permission name separated by "::" (note the double colon) | ||
# <roleID>::<resourceServerIdentifier>::<permission> | ||
# | ||
# Example: | ||
terraform import auth0_role_permission.permission "rol_XXXXXXXXXXXXX::https://example.com::read:foo" |
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,40 @@ | ||
# Example: | ||
resource "auth0_resource_server" "resource_server" { | ||
name = "test" | ||
identifier = "test.example.com" | ||
} | ||
|
||
resource "auth0_resource_server_scopes" "resource_server_scopes" { | ||
resource_server_identifier = auth0_resource_server.resource_server.identifier | ||
|
||
scopes { | ||
name = "store:create" | ||
} | ||
scopes { | ||
name = "store:read" | ||
} | ||
scopes { | ||
name = "store:update" | ||
} | ||
scopes { | ||
name = "store:delete" | ||
} | ||
} | ||
|
||
resource "auth0_role" "my_role" { | ||
name = "My Role" | ||
} | ||
|
||
locals { | ||
scopesList = [ | ||
for scope in auth0_resource_server_scopes.resource_server_scopes.scopes : scope.name | ||
] | ||
} | ||
|
||
resource "auth0_role_permission" "my_role_perm" { | ||
for_each = toset(local.scopesList) | ||
|
||
role_id = auth0_role.my_role.id | ||
resource_server_identifier = auth0_resource_server.resource_server.identifier | ||
permission = each.value | ||
} |
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,4 @@ | ||
# This resource can be imported by specifying the role ID | ||
# | ||
# Example: | ||
terraform import auth0_role_permissions.all_role_permissions "rol_XXXXXXXXXXXX" |
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,37 @@ | ||
# Example: | ||
resource "auth0_resource_server" "resource_server" { | ||
name = "test" | ||
identifier = "test.example.com" | ||
} | ||
resource "auth0_resource_server_scopes" "resource_server_scopes" { | ||
resource_server_identifier = auth0_resource_server.resource_server.identifier | ||
|
||
scopes { | ||
name = "store:create" | ||
} | ||
scopes { | ||
name = "store:read" | ||
} | ||
scopes { | ||
name = "store:update" | ||
} | ||
scopes { | ||
name = "store:delete" | ||
} | ||
} | ||
|
||
resource "auth0_role" "my_role" { | ||
name = "My Role" | ||
} | ||
|
||
resource "auth0_role_permissions" "my_role_perms" { | ||
role_id = auth0_role.my_role.id | ||
|
||
dynamic "permissions" { | ||
for_each = auth0_resource_server_scopes.resource_server_scopes.scopes | ||
content { | ||
name = permissions.value.name | ||
resource_server_identifier = auth0_resource_server.resource_server.identifier | ||
} | ||
} | ||
} |