Skip to content

Commit

Permalink
Custom doc templates for user permission and user permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
willvedd committed May 11, 2023
1 parent d52e6af commit 56a5447
Show file tree
Hide file tree
Showing 4 changed files with 155 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/resources/user_permission.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ description: |-

With this resource, you can manage user permissions.

!> To prevent issues, avoid using this resource together with the `auth0_user_permissions` resource.

## Example Usage

```terraform
Expand Down
91 changes: 91 additions & 0 deletions docs/resources/user_permissions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
page_title: "Resource: auth0_user_permissions"
description: |-
With this resource, you can manage all of a user's permissions.
---

# Resource: auth0_user_permissions

With this resource, you can manage all of a user's permissions.

!> To prevent issues, avoid using this resource together with the `auth0_user_permission` resource.

## Example Usage

```terraform
resource "auth0_resource_server" "resource_server" {
name = "Example Resource Server (Managed by Terraform)"
identifier = "https://api.example.com"
scopes {
value = "create:foo"
description = "Create foos"
}
scopes {
value = "read:foo"
description = "Read foos"
}
}
resource "auth0_user" "user" {
connection_name = "Username-Password-Authentication"
user_id = "12345"
username = "unique_username"
name = "Firstname Lastname"
nickname = "some.nickname"
email = "[email protected]"
email_verified = true
password = "passpass$12$12"
picture = "https://www.example.com/a-valid-picture-url.jpg"
}
resource "auth0_user_permissions" "all_user_permissions" {
user_id = auth0_user.user.id
permissions {
name = tolist(auth0_resource_server.resource_server.scopes)[0]
resource_server_identifier = auth0_resource_server.resource_server.identifier
}
permissions {
name = tolist(auth0_resource_server.resource_server.scopes)[1]
resource_server_identifier = auth0_resource_server.resource_server.identifier
}
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `permissions` (Block Set, Min: 1) List of API permissions granted to the user. (see [below for nested schema](#nestedblock--permissions))
- `user_id` (String) ID of the user to associate the permission to.

### Read-Only

- `id` (String) The ID of this resource.

<a id="nestedblock--permissions"></a>
### Nested Schema for `permissions`

Required:

- `name` (String) Name of permission.
- `resource_server_identifier` (String) Resource server identifier associated with the permission.

Read-Only:

- `description` (String) Description of the permission.
- `resource_server_name` (String) Name of resource server that the permission is associated with.

## Import

Import is supported using the following syntax:

```shell
# This resource can be imported by specifying the user ID

# Example:
terraform import auth0_user_permissions.all_user_permissions "auth0|111111111111111111111111"
```
31 changes: 31 additions & 0 deletions templates/resources/user_permission.md.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
page_title: "{{.Type}}: {{.Name}}"
description: |-
{{ .Description | plainmarkdown | trimspace | prefixlines " " }}
---

# {{.Type}}: {{.Name}}

{{ .Description | trimspace }}

!> To prevent issues, avoid using this resource together with the `auth0_user_permissions` resource.

{{ if .HasExample -}}

## Example Usage

{{ tffile .ExampleFile }}

{{- end }}

{{ .SchemaMarkdown | trimspace }}

{{ if .HasImport -}}

## Import

Import is supported using the following syntax:

{{ codefile "shell" .ImportFile }}

{{- end }}
31 changes: 31 additions & 0 deletions templates/resources/user_permissions.md.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
page_title: "{{.Type}}: {{.Name}}"
description: |-
{{ .Description | plainmarkdown | trimspace | prefixlines " " }}
---

# {{.Type}}: {{.Name}}

{{ .Description | trimspace }}

!> To prevent issues, avoid using this resource together with the `auth0_user_permission` resource.

{{ if .HasExample -}}

## Example Usage

{{ tffile .ExampleFile }}

{{- end }}

{{ .SchemaMarkdown | trimspace }}

{{ if .HasImport -}}

## Import

Import is supported using the following syntax:

{{ codefile "shell" .ImportFile }}

{{- end }}

0 comments on commit 56a5447

Please sign in to comment.