Skip to content

Commit 5634558

Browse files
committed
feat(authorization): implement folder_role_assignment resource
Signed-off-by: Mauritz Uphoff <mauritz.uphoff@stackit.cloud>
1 parent b5f82e7 commit 5634558

File tree

18 files changed

+902
-196
lines changed

18 files changed

+902
-196
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "stackit_authorization_folder_role_assignment Resource - stackit"
4+
subcategory: ""
5+
description: |-
6+
Folder Role Assignment resource schema.
7+
~> This resource is part of the iam experiment and is likely going to undergo significant changes or be removed in the future. Use it at your own discretion.
8+
---
9+
10+
# stackit_authorization_folder_role_assignment (Resource)
11+
12+
Folder Role Assignment resource schema.
13+
14+
~> This resource is part of the iam experiment and is likely going to undergo significant changes or be removed in the future. Use it at your own discretion.
15+
16+
## Example Usage
17+
18+
```terraform
19+
resource "stackit_resourcemanager_folder" "example" {
20+
name = "example_folder"
21+
owner_email = "foo.bar@stackit.cloud"
22+
# in this case a org-id
23+
parent_container_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
24+
}
25+
26+
resource "stackit_authorization_folder_role_assignment" "fra" {
27+
resource_id = stackit_resourcemanager_folder.example.folder_id
28+
role = "reader"
29+
subject = "foo.bar@stackit.cloud"
30+
}
31+
32+
# Only use the import statement, if you want to import an existing folder role assignment
33+
import {
34+
to = stackit_authorization_folder_role_assignment.import-example
35+
id = "${var.folder_id},${var.folder_role_assignment},${var.folder_role_assignment_subject}"
36+
}
37+
```
38+
39+
<!-- schema generated by tfplugindocs -->
40+
## Schema
41+
42+
### Required
43+
44+
- `resource_id` (String) folder Resource to assign the role to.
45+
- `role` (String) Role to be assigned. Available roles can be queried using stackit-cli: `stackit curl https://authorization.api.stackit.cloud/v2/permissions`
46+
- `subject` (String) Identifier of user, service account or client. Usually email address or name in case of clients
47+
48+
### Read-Only
49+
50+
- `id` (String) Terraform's internal resource identifier. It is structured as "`resource_id`,`role`,`subject`".

docs/resources/authorization_organization_role_assignment.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
page_title: "stackit_authorization_organization_role_assignment Resource - stackit"
44
subcategory: ""
55
description: |-
6-
organization Role Assignment resource schema.
6+
Organization Role Assignment resource schema.
77
~> This resource is part of the iam experiment and is likely going to undergo significant changes or be removed in the future. Use it at your own discretion.
88
---
99

1010
# stackit_authorization_organization_role_assignment (Resource)
1111

12-
organization Role Assignment resource schema.
12+
Organization Role Assignment resource schema.
1313

1414
~> This resource is part of the iam experiment and is likely going to undergo significant changes or be removed in the future. Use it at your own discretion.
1515

@@ -35,9 +35,9 @@ import {
3535
### Required
3636

3737
- `resource_id` (String) organization Resource to assign the role to.
38-
- `role` (String) Role to be assigned
38+
- `role` (String) Role to be assigned. Available roles can be queried using stackit-cli: `stackit curl https://authorization.api.stackit.cloud/v2/permissions`
3939
- `subject` (String) Identifier of user, service account or client. Usually email address or name in case of clients
4040

4141
### Read-Only
4242

43-
- `id` (String) Terraform's internal resource identifier. It is structured as "[resource_id],[role],[subject]".
43+
- `id` (String) Terraform's internal resource identifier. It is structured as "`resource_id`,`role`,`subject`".

docs/resources/authorization_project_role_assignment.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,30 @@
33
page_title: "stackit_authorization_project_role_assignment Resource - stackit"
44
subcategory: ""
55
description: |-
6-
project Role Assignment resource schema.
6+
Project Role Assignment resource schema.
77
~> This resource is part of the iam experiment and is likely going to undergo significant changes or be removed in the future. Use it at your own discretion.
88
---
99

1010
# stackit_authorization_project_role_assignment (Resource)
1111

12-
project Role Assignment resource schema.
12+
Project Role Assignment resource schema.
1313

1414
~> This resource is part of the iam experiment and is likely going to undergo significant changes or be removed in the future. Use it at your own discretion.
1515

1616
## Example Usage
1717

1818
```terraform
19-
resource "stackit_authorization_project_role_assignment" "example" {
20-
resource_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
21-
role = "owner"
22-
subject = "john.doe@stackit.cloud"
19+
resource "stackit_resourcemanager_project" "example" {
20+
name = "example_project"
21+
owner_email = "foo.bar@stackit.cloud"
22+
# in this case a folder or a org-id
23+
parent_container_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
24+
}
25+
26+
resource "stackit_authorization_project_role_assignment" "pra" {
27+
resource_id = stackit_resourcemanager_project.example.folder_id
28+
role = "reader"
29+
subject = "foo.bar@stackit.cloud"
2330
}
2431
2532
# Only use the import statement, if you want to import an existing project role assignment
@@ -35,9 +42,9 @@ import {
3542
### Required
3643

3744
- `resource_id` (String) project Resource to assign the role to.
38-
- `role` (String) Role to be assigned
45+
- `role` (String) Role to be assigned. Available roles can be queried using stackit-cli: `stackit curl https://authorization.api.stackit.cloud/v2/permissions`
3946
- `subject` (String) Identifier of user, service account or client. Usually email address or name in case of clients
4047

4148
### Read-Only
4249

43-
- `id` (String) Terraform's internal resource identifier. It is structured as "[resource_id],[role],[subject]".
50+
- `id` (String) Terraform's internal resource identifier. It is structured as "`resource_id`,`role`,`subject`".
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
resource "stackit_resourcemanager_folder" "example" {
2+
name = "example_folder"
3+
owner_email = "foo.bar@stackit.cloud"
4+
# in this case a org-id
5+
parent_container_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
6+
}
7+
8+
resource "stackit_authorization_folder_role_assignment" "fra" {
9+
resource_id = stackit_resourcemanager_folder.example.folder_id
10+
role = "reader"
11+
subject = "foo.bar@stackit.cloud"
12+
}
13+
14+
# Only use the import statement, if you want to import an existing folder role assignment
15+
import {
16+
to = stackit_authorization_folder_role_assignment.import-example
17+
id = "${var.folder_id},${var.folder_role_assignment},${var.folder_role_assignment_subject}"
18+
}

examples/resources/stackit_authorization_project_role_assignment/resource.tf

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1-
resource "stackit_authorization_project_role_assignment" "example" {
2-
resource_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
3-
role = "owner"
4-
subject = "john.doe@stackit.cloud"
1+
resource "stackit_resourcemanager_project" "example" {
2+
name = "example_project"
3+
owner_email = "foo.bar@stackit.cloud"
4+
# in this case a folder or a org-id
5+
parent_container_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
6+
}
7+
8+
resource "stackit_authorization_project_role_assignment" "pra" {
9+
resource_id = stackit_resourcemanager_project.example.folder_id
10+
role = "reader"
11+
subject = "foo.bar@stackit.cloud"
512
}
613

714
# Only use the import statement, if you want to import an existing project role assignment

0 commit comments

Comments
 (0)