Skip to content

Commit

Permalink
Update docs examples
Browse files Browse the repository at this point in the history
  • Loading branch information
sarvesh-cast committed Jan 7, 2025
1 parent 213ebb7 commit f131bd7
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 26 deletions.
56 changes: 55 additions & 1 deletion docs/resources/role_bindings.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions docs/resources/service_account.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 15 additions & 1 deletion docs/resources/service_account_key.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 51 additions & 0 deletions examples/resources/castai_role_bindings/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
data "castai_organization" "test" {
name = "My test organization name"
}

resource "castai_role_bindings" "owner_test" {
organization_id = data.castai_organization.test.id
name = "Role binding owner"
description = "Owner access for whole organization."

role_id = "3e1050c7-6593-4298-94bb-154637911d78" # Role "Owner"
scope {
kind = "organization"
resource_id = data.castai_organization.test.id
}
subjects {
subject {
kind = "user"
user_id = "21c133e2-a899-4f51-b297-830bc62e51d6" # user x
}
subject {
kind = "user"
user_id = "0d1efe35-7ecb-4821-a52d-fd56c9710a64" # user y
}
subject {
kind = "group"
group_id = "651734a7-0d0c-49f3-9654-dd92175febaa"
}
subject {
kind = "service_account"
service_account_id = "3bf49513-3e9c-4a12-962c-af3bb1a85074"
}
}
}

resource "castai_role_bindings" "viewer_test" {
organization_id = data.castai_organization.test.id
name = "Role binding viewer for cluster 7063d31c-897e-48ef-a322-bdfda6fdbcfb"
description = "Viewer access for on of the clusters."

role_id = "6fc95bd7-6049-4735-80b0-ce5ccde71cb1" # Role "Viewer"
scope {
kind = "cluster"
resource_id = "7063d31c-897e-48ef-a322-bdfda6fdbcfb"
}
subjects {
subject {
kind = "user"
user_id = "21c133e2-a899-4f51-b297-830bc62e51d6" # user z
}
}
}
12 changes: 0 additions & 12 deletions examples/resources/castai_service_account/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,3 @@ resource "castai_service_account" "service_account" {
name = "example-service-account"
description = "service account description"
}

resource "castai_service_account_key" "service_account_key" {
organization_id = data.castai_organization.test.id
service_account_id = castai_service_account.service_account.id
name = "example-key"
active = true
expires_at = "2025-01-01T00:00:00Z"
}

output "service_account_key" {
value = castai_service_account_key.service_account_key.token
}
11 changes: 11 additions & 0 deletions examples/resources/castai_service_account_key/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
resource "castai_service_account_key" "service_account_key" {
organization_id = data.castai_organization.test.id
service_account_id = castai_service_account.service_account.id
name = "example-key"
active = true
expires_at = "2025-01-01T00:00:00Z"
}

output "service_account_key" {
value = castai_service_account_key.service_account_key.token
}

0 comments on commit f131bd7

Please sign in to comment.