Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: define import example for resources #113

Merged
merged 5 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions docs/resources/project_access.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ ProjectAccess schema
## Example Usage

```terraform
import {
project = "default"
to = unleash_project_access.default_project_access
}

resource "unleash_project" "sample_project" {
id = "sample"
name = "sample-project"
Expand Down Expand Up @@ -61,6 +66,18 @@ resource "unleash_project_access" "sample_project_access" {
},
]
}

resource "unleash_project_access" "default_project_access" {
roles = [
{
role = data.unleash_role.project_owner_role.id
users = [
unleash_user.test_user.id
]
groups = []
},
]
}
```

<!-- schema generated by tfplugindocs -->
Expand Down
15 changes: 15 additions & 0 deletions docs/resources/role.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,21 @@ Role schema
## Example Usage

```terraform
import {
id = 5
to = unleash_role.project_member_role
}

resource "unleash_role" "project_member_role" {
permissions = [{
name = "CREATE_PROJECT"
}, {
name = "UPDATE_PROJECT"
}, {
name = "DELETE_PROJECT"
}]
}

resource "unleash_role" "custom_root_role" {
name = "A custom role"
type = "root-custom"
Expand Down
12 changes: 12 additions & 0 deletions docs/resources/user.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ User schema
## Example Usage

```terraform
import {
id = 1
to = unleash_user.admin
}

resource "unleash_user" "admin" {
email = "[email protected]"
name = "Chuck Norris"
root_role = 1
send_email = false
}

resource "unleash_user" "chuck" {
email = "[email protected]"
name = "Chuck Norris"
Expand Down
19 changes: 18 additions & 1 deletion examples/resources/unleash_project_access/resource.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
import {
project = "default"
to = unleash_project_access.default_project_access
}

resource "unleash_project" "sample_project" {
id = "sample"
name = "sample-project"
Expand Down Expand Up @@ -45,4 +50,16 @@ resource "unleash_project_access" "sample_project_access" {
groups = []
},
]
}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intention is to import the default project access and override the owner

resource "unleash_project_access" "default_project_access" {
roles = [
{
role = data.unleash_role.project_owner_role.id
users = [
unleash_user.test_user.id
]
groups = []
},
]
}
17 changes: 16 additions & 1 deletion examples/resources/unleash_role/resource.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
import {
id = 5
to = unleash_role.project_member_role
}

resource "unleash_role" "project_member_role" {
permissions = [{
name = "CREATE_PROJECT"
}, {
name = "UPDATE_PROJECT"
}, {
name = "DELETE_PROJECT"
}]
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intention here is to import the project member role and override the permissions

resource "unleash_role" "custom_root_role" {
name = "A custom role"
type = "root-custom"
Expand Down Expand Up @@ -33,4 +48,4 @@ resource "unleash_role" "project_role" {
name = "UPDATE_FEATURE_ENVIRONMENT"
environment = "development"
}]
}
}
14 changes: 13 additions & 1 deletion examples/resources/unleash_user/resource.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
import {
id = 1
to = unleash_user.admin
}

resource "unleash_user" "admin" {
email = "[email protected]"
name = "Chuck Norris"
root_role = 1
send_email = false
}

resource "unleash_user" "chuck" {
email = "[email protected]"
name = "Chuck Norris"
Expand All @@ -11,4 +23,4 @@ resource "unleash_user" "with_password" {
root_role = 1
send_email = false
password = "youcanseeme"
}
}
Loading