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 2 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
5 changes: 5 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 = "sample"
to = unleash_project_access.sample_project_access
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure if this will work, because the resource is being created in line 50. What you can import maybe is the default project access

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it thanks. Importing the default project access and overriding the owner (I think)


resource "unleash_project" "sample_project" {
id = "sample"
name = "sample-project"
Expand Down
5 changes: 5 additions & 0 deletions docs/resources/role.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ Role schema
## Example Usage

```terraform
import {
id = 5
to = unleash_role.custom_root_role
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

5 is the id of the predefined Project Member role, maybe we should add it as a resource that is imported rather than a custom_root_role which could be misleading


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
7 changes: 6 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 = "sample"
to = unleash_project_access.sample_project_access
}

resource "unleash_project" "sample_project" {
id = "sample"
name = "sample-project"
Expand Down Expand Up @@ -45,4 +50,4 @@ resource "unleash_project_access" "sample_project_access" {
groups = []
},
]
}
}
7 changes: 6 additions & 1 deletion examples/resources/unleash_role/resource.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
import {
id = 5
to = unleash_role.custom_root_role
}

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 +38,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