Skip to content

Commit

Permalink
chore: update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
henryde committed Jun 20, 2024
1 parent 6b2d5cf commit f6aed7a
Show file tree
Hide file tree
Showing 7 changed files with 187 additions and 4 deletions.
68 changes: 68 additions & 0 deletions docs/data-sources/project_user_binding.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "meshstack_project_user_binding Data Source - terraform-provider-meshstack"
subcategory: ""
description: |-
Single project user binding by name.
---

# meshstack_project_user_binding (Data Source)

Single project user binding by name.

## Example Usage

```terraform
data "meshstack_project_user_binding" "example" {
metadata = {
name = "214cb14d-2e21-11ef-8e80-0242ac130003"
}
}
```

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

### Required

- `metadata` (Attributes) Project role assigned by this binding. (see [below for nested schema](#nestedatt--metadata))

### Read-Only

- `api_version` (String) Project user binding datatype version
- `kind` (String) meshObject type, always `meshProjectUserBinding`.
- `role_ref` (Attributes) Project role assigned by this binding. (see [below for nested schema](#nestedatt--role_ref))
- `subject` (Attributes) Users assigned by this binding. (see [below for nested schema](#nestedatt--subject))
- `target_ref` (Attributes) Project, identified by workspace and project identifier. (see [below for nested schema](#nestedatt--target_ref))

<a id="nestedatt--metadata"></a>
### Nested Schema for `metadata`

Required:

- `name` (String)


<a id="nestedatt--role_ref"></a>
### Nested Schema for `role_ref`

Read-Only:

- `name` (String)


<a id="nestedatt--subject"></a>
### Nested Schema for `subject`

Read-Only:

- `name` (String) Username.


<a id="nestedatt--target_ref"></a>
### Nested Schema for `target_ref`

Read-Only:

- `name` (String)
- `owned_by_workspace` (String)
90 changes: 90 additions & 0 deletions docs/resources/project_user_binding.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "meshstack_project_user_binding Resource - terraform-provider-meshstack"
subcategory: ""
description: |-
Project user binding assigns a user with a specific role to a project.
---

# meshstack_project_user_binding (Resource)

Project user binding assigns a user with a specific role to a project.

## Example Usage

```terraform
resource "meshstack_project_user_binding" "example" {
metadata = {
name = "this-is-an-example"
}
role_ref = {
name = "Project Reader"
}
target_ref = {
owned_by_workspace = "my-customer"
name = "my-project"
}
subject = {
name = "user@meshcloud.io"
}
}
```

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

### Required

- `metadata` (Attributes) Project user binding metadata. (see [below for nested schema](#nestedatt--metadata))
- `role_ref` (Attributes) Selects the role to use for this project binding. (see [below for nested schema](#nestedatt--role_ref))
- `subject` (Attributes) Selects the user for this binding. (see [below for nested schema](#nestedatt--subject))
- `target_ref` (Attributes) Selects the project to which this binding applies. (see [below for nested schema](#nestedatt--target_ref))

### Read-Only

- `api_version` (String) Project user binding datatype version
- `kind` (String) meshObject type, always `meshProjectUserBinding`.

<a id="nestedatt--metadata"></a>
### Nested Schema for `metadata`

Required:

- `name` (String) The name identifies the binding and must be unique across the meshStack.


<a id="nestedatt--role_ref"></a>
### Nested Schema for `role_ref`

Required:

- `name` (String)


<a id="nestedatt--subject"></a>
### Nested Schema for `subject`

Required:

- `name` (String) Username.


<a id="nestedatt--target_ref"></a>
### Nested Schema for `target_ref`

Required:

- `name` (String) Project identifier.
- `owned_by_workspace` (String) Identifier of workspace containing the target project.

## Import

Import is supported using the following syntax:

```shell
# import via project binding name
terraform import 'meshstack_project_user_binding.example' 'my-binding-name'
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
data "meshstack_project_user_binding" "example" {
metadata = {
name = "214cb14d-2e21-11ef-8e80-0242ac130003"
}
}
2 changes: 2 additions & 0 deletions examples/resources/meshstack_project_user_binding/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# import via project binding name
terraform import 'meshstack_project_user_binding.example' 'my-binding-name'
18 changes: 18 additions & 0 deletions examples/resources/meshstack_project_user_binding/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
resource "meshstack_project_user_binding" "example" {
metadata = {
name = "this-is-an-example"
}

role_ref = {
name = "Project Reader"
}

target_ref = {
owned_by_workspace = "my-customer"
name = "my-project"
}

subject = {
name = "user@meshcloud.io"
}
}
2 changes: 1 addition & 1 deletion internal/provider/project_user_binding_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func (d *projectUserBindingsDataSource) Metadata(ctx context.Context, req dataso

func (d *projectUserBindingsDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
resp.Schema = schema.Schema{
MarkdownDescription: "Single project by name and workspace.",
MarkdownDescription: "Single project user binding by name.",

Attributes: map[string]schema.Attribute{
"api_version": schema.StringAttribute{
Expand Down
6 changes: 3 additions & 3 deletions internal/provider/project_user_binding_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ func (r *projectUserBindingResource) Schema(_ context.Context, _ resource.Schema
},

"metadata": schema.SingleNestedAttribute{
Optional: true,
Required: true,
MarkdownDescription: "Project user binding metadata.",
Attributes: map[string]schema.Attribute{
"name": schema.StringAttribute{
MarkdownDescription: "The name identifies the binding and must be unique across the meshStack. A UUID will automatically be used if left unset.",
Optional: true,
MarkdownDescription: "The name identifies the binding and must be unique across the meshStack.",
Required: true,
PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace()},
Validators: []validator.String{
stringvalidator.LengthBetween(1, 45),
Expand Down

0 comments on commit f6aed7a

Please sign in to comment.