Skip to content

Commit 37fa529

Browse files
authored
Update docs for rbac v2 (#439)
1 parent 1fe0630 commit 37fa529

File tree

6 files changed

+132
-26
lines changed

6 files changed

+132
-26
lines changed

docs/resources/role_bindings.md

Lines changed: 55 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/resources/service_account.md

Lines changed: 0 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/resources/service_account_key.md

Lines changed: 15 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
data "castai_organization" "test" {
2+
name = "My test organization name"
3+
}
4+
5+
resource "castai_role_bindings" "owner_test" {
6+
organization_id = data.castai_organization.test.id
7+
name = "Role binding owner"
8+
description = "Owner access for whole organization."
9+
10+
role_id = "3e1050c7-6593-4298-94bb-154637911d78" # Role "Owner"
11+
scope {
12+
kind = "organization"
13+
resource_id = data.castai_organization.test.id
14+
}
15+
subjects {
16+
subject {
17+
kind = "user"
18+
user_id = "21c133e2-a899-4f51-b297-830bc62e51d6" # user x
19+
}
20+
subject {
21+
kind = "user"
22+
user_id = "0d1efe35-7ecb-4821-a52d-fd56c9710a64" # user y
23+
}
24+
subject {
25+
kind = "group"
26+
group_id = "651734a7-0d0c-49f3-9654-dd92175febaa"
27+
}
28+
subject {
29+
kind = "service_account"
30+
service_account_id = "3bf49513-3e9c-4a12-962c-af3bb1a85074"
31+
}
32+
}
33+
}
34+
35+
resource "castai_role_bindings" "viewer_test" {
36+
organization_id = data.castai_organization.test.id
37+
name = "Role binding viewer for cluster 7063d31c-897e-48ef-a322-bdfda6fdbcfb"
38+
description = "Viewer access for on of the clusters."
39+
40+
role_id = "6fc95bd7-6049-4735-80b0-ce5ccde71cb1" # Role "Viewer"
41+
scope {
42+
kind = "cluster"
43+
resource_id = "7063d31c-897e-48ef-a322-bdfda6fdbcfb"
44+
}
45+
subjects {
46+
subject {
47+
kind = "user"
48+
user_id = "21c133e2-a899-4f51-b297-830bc62e51d6" # user z
49+
}
50+
}
51+
}

examples/resources/castai_service_account/resource.tf

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,3 @@ resource "castai_service_account" "service_account" {
33
name = "example-service-account"
44
description = "service account description"
55
}
6-
7-
resource "castai_service_account_key" "service_account_key" {
8-
organization_id = data.castai_organization.test.id
9-
service_account_id = castai_service_account.service_account.id
10-
name = "example-key"
11-
active = true
12-
expires_at = "2025-01-01T00:00:00Z"
13-
}
14-
15-
output "service_account_key" {
16-
value = castai_service_account_key.service_account_key.token
17-
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
resource "castai_service_account_key" "service_account_key" {
2+
organization_id = data.castai_organization.test.id
3+
service_account_id = castai_service_account.service_account.id
4+
name = "example-key"
5+
active = true
6+
expires_at = "2026-01-01T00:00:00Z"
7+
}
8+
9+
output "service_account_key" {
10+
value = castai_service_account_key.service_account_key.token
11+
}

0 commit comments

Comments
 (0)