Skip to content

Commit ca99208

Browse files
authored
feat: support IAM policy resource (#105)
* chore: support all users in project IAM * feat: support iam resource * fix: eslint * fix: eslint * fix: test
1 parent f59e7f2 commit ca99208

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+729
-682
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.22
1+
1.0.23

docs/data-sources/group.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ The group data source.
2424
- `description` (String) The group description.
2525
- `id` (String) The ID of this resource.
2626
- `members` (Set of Object) The members in the group. (see [below for nested schema](#nestedatt--members))
27-
- `roles` (Set of String) The group's roles in the workspace level
2827
- `source` (String) Source means where the group comes from. For now we support Entra ID SCIM sync, so the source could be Entra ID.
2928
- `title` (String) The group title.
3029

docs/data-sources/group_list.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ Read-Only:
2828
- `description` (String)
2929
- `members` (Set of Object) (see [below for nested schema](#nestedobjatt--groups--members))
3030
- `name` (String)
31-
- `roles` (Set of String)
3231
- `source` (String)
3332
- `title` (String)
3433

docs/data-sources/iam_policy.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "bytebase_iam_policy Data Source - terraform-provider-bytebase"
4+
subcategory: ""
5+
description: |-
6+
The IAM policy data source.
7+
---
8+
9+
# bytebase_iam_policy (Data Source)
10+
11+
The IAM policy data source.
12+
13+
14+
15+
<!-- schema generated by tfplugindocs -->
16+
## Schema
17+
18+
### Required
19+
20+
- `parent` (String) The IAM policy parent name for the policy, support "projects/{resource id}" or "workspaces/-"
21+
22+
### Optional
23+
24+
- `iam_policy` (Block List, Max: 1) (see [below for nested schema](#nestedblock--iam_policy))
25+
26+
### Read-Only
27+
28+
- `id` (String) The ID of this resource.
29+
30+
<a id="nestedblock--iam_policy"></a>
31+
### Nested Schema for `iam_policy`
32+
33+
Optional:
34+
35+
- `binding` (Block Set) The binding in the IAM policy. (see [below for nested schema](#nestedblock--iam_policy--binding))
36+
37+
<a id="nestedblock--iam_policy--binding"></a>
38+
### Nested Schema for `iam_policy.binding`
39+
40+
Optional:
41+
42+
- `condition` (Block Set) Match the condition limit. (see [below for nested schema](#nestedblock--iam_policy--binding--condition))
43+
- `members` (Set of String) A set of memebers. The value can be "allUsers", "user:{email}" or "group:{email}".
44+
- `role` (String) The role full name in roles/{id} format.
45+
46+
<a id="nestedblock--iam_policy--binding--condition"></a>
47+
### Nested Schema for `iam_policy.binding.condition`
48+
49+
Optional:
50+
51+
- `database` (String) The accessible database full name in instances/{instance resource id}/databases/{database name} format
52+
- `expire_timestamp` (String) The expiration timestamp in YYYY-MM-DDThh:mm:ssZ format
53+
- `row_limit` (Number) The export row limit for exporter role
54+
- `schema` (String) The accessible schema in the database
55+
- `tables` (Set of String) The accessible table list
56+
57+

docs/data-sources/project.md

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,30 +27,9 @@ The project data source.
2727
- `databases` (Set of String) The databases full name in the resource.
2828
- `enforce_issue_title` (Boolean) Enforce issue title created by user instead of generated by Bytebase.
2929
- `id` (String) The ID of this resource.
30-
- `members` (Set of Object) The members in the project. (see [below for nested schema](#nestedatt--members))
3130
- `name` (String) The project full name in projects/{resource id} format.
3231
- `postgres_database_tenant_mode` (Boolean) Whether to enable the database tenant mode for PostgreSQL. If enabled, the issue will be created with the pre-appended "set role <db_owner>" statement.
3332
- `skip_backup_errors` (Boolean) Whether to skip backup errors and continue the data migration.
3433
- `title` (String) The project title.
3534

36-
<a id="nestedatt--members"></a>
37-
### Nested Schema for `members`
38-
39-
Read-Only:
40-
41-
- `condition` (Set of Object) (see [below for nested schema](#nestedobjatt--members--condition))
42-
- `member` (String)
43-
- `role` (String)
44-
45-
<a id="nestedobjatt--members--condition"></a>
46-
### Nested Schema for `members.condition`
47-
48-
Read-Only:
49-
50-
- `database` (String)
51-
- `expire_timestamp` (String)
52-
- `row_limit` (Number)
53-
- `schema` (String)
54-
- `tables` (Set of String)
55-
5635

docs/data-sources/project_list.md

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -36,31 +36,10 @@ Read-Only:
3636
- `auto_resolve_issue` (Boolean)
3737
- `databases` (Set of String)
3838
- `enforce_issue_title` (Boolean)
39-
- `members` (Set of Object) (see [below for nested schema](#nestedobjatt--projects--members))
4039
- `name` (String)
4140
- `postgres_database_tenant_mode` (Boolean)
4241
- `resource_id` (String)
4342
- `skip_backup_errors` (Boolean)
4443
- `title` (String)
4544

46-
<a id="nestedobjatt--projects--members"></a>
47-
### Nested Schema for `projects.members`
48-
49-
Read-Only:
50-
51-
- `condition` (Set of Object) (see [below for nested schema](#nestedobjatt--projects--members--condition))
52-
- `member` (String)
53-
- `role` (String)
54-
55-
<a id="nestedobjatt--projects--members--condition"></a>
56-
### Nested Schema for `projects.members.condition`
57-
58-
Read-Only:
59-
60-
- `database` (String)
61-
- `expire_timestamp` (String)
62-
- `row_limit` (Number)
63-
- `schema` (String)
64-
- `tables` (Set of String)
65-
6645

docs/data-sources/user.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ The user data source.
2727
- `last_login_time` (String) The user last login time.
2828
- `mfa_enabled` (Boolean) The mfa_enabled flag means if the user has enabled MFA.
2929
- `phone` (String) The user phone.
30-
- `roles` (Set of String) The user's roles in the workspace level
3130
- `source` (String) Source means where the user comes from. For now we support Entra ID SCIM sync, so the source could be Entra ID.
3231
- `state` (String) The user is deleted or not.
3332
- `title` (String) The user title.

docs/data-sources/user_list.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ Read-Only:
3939
- `mfa_enabled` (Boolean)
4040
- `name` (String)
4141
- `phone` (String)
42-
- `roles` (Set of String)
4342
- `source` (String)
4443
- `state` (String)
4544
- `title` (String)

docs/resources/group.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ The group resource. Workspace domain is required for creating groups.
2424
### Optional
2525

2626
- `description` (String) The group description.
27-
- `roles` (Set of String) The group's roles in the workspace level
2827

2928
### Read-Only
3029

docs/resources/iam_policy.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "bytebase_iam_policy Resource - terraform-provider-bytebase"
4+
subcategory: ""
5+
description: |-
6+
The IAM policy resource.
7+
---
8+
9+
# bytebase_iam_policy (Resource)
10+
11+
The IAM policy resource.
12+
13+
14+
15+
<!-- schema generated by tfplugindocs -->
16+
## Schema
17+
18+
### Required
19+
20+
- `parent` (String) The IAM policy parent name for the policy, support "projects/{resource id}" or "workspaces/-"
21+
22+
### Optional
23+
24+
- `iam_policy` (Block List, Max: 1) (see [below for nested schema](#nestedblock--iam_policy))
25+
26+
### Read-Only
27+
28+
- `id` (String) The ID of this resource.
29+
30+
<a id="nestedblock--iam_policy"></a>
31+
### Nested Schema for `iam_policy`
32+
33+
Optional:
34+
35+
- `binding` (Block Set) The binding in the IAM policy. (see [below for nested schema](#nestedblock--iam_policy--binding))
36+
37+
<a id="nestedblock--iam_policy--binding"></a>
38+
### Nested Schema for `iam_policy.binding`
39+
40+
Optional:
41+
42+
- `condition` (Block Set) Match the condition limit. (see [below for nested schema](#nestedblock--iam_policy--binding--condition))
43+
- `members` (Set of String) A set of memebers. The value can be "allUsers", "user:{email}" or "group:{email}".
44+
- `role` (String) The role full name in roles/{id} format.
45+
46+
<a id="nestedblock--iam_policy--binding--condition"></a>
47+
### Nested Schema for `iam_policy.binding.condition`
48+
49+
Optional:
50+
51+
- `database` (String) The accessible database full name in instances/{instance resource id}/databases/{database name} format
52+
- `expire_timestamp` (String) The expiration timestamp in YYYY-MM-DDThh:mm:ssZ format
53+
- `row_limit` (Number) The export row limit for exporter role
54+
- `schema` (String) The accessible schema in the database
55+
- `tables` (Set of String) The accessible table list
56+
57+

docs/resources/project.md

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ The project resource.
2727
- `auto_resolve_issue` (Boolean) Enable auto resolve issue.
2828
- `databases` (Set of String) The databases full name in the resource.
2929
- `enforce_issue_title` (Boolean) Enforce issue title created by user instead of generated by Bytebase.
30-
- `members` (Block Set) The members in the project. (see [below for nested schema](#nestedblock--members))
3130
- `postgres_database_tenant_mode` (Boolean) Whether to enable the database tenant mode for PostgreSQL. If enabled, the issue will be created with the pre-appended "set role <db_owner>" statement.
3231
- `skip_backup_errors` (Boolean) Whether to skip backup errors and continue the data migration.
3332

@@ -36,24 +35,4 @@ The project resource.
3635
- `id` (String) The ID of this resource.
3736
- `name` (String) The project full name in projects/{resource id} format.
3837

39-
<a id="nestedblock--members"></a>
40-
### Nested Schema for `members`
41-
42-
Optional:
43-
44-
- `condition` (Block Set) Match the condition limit. (see [below for nested schema](#nestedblock--members--condition))
45-
- `member` (String) The member in user:{email} or group:{email} format.
46-
- `role` (String) The role full name in roles/{id} format.
47-
48-
<a id="nestedblock--members--condition"></a>
49-
### Nested Schema for `members.condition`
50-
51-
Optional:
52-
53-
- `database` (String) The accessible database full name in instances/{instance resource id}/databases/{database name} format
54-
- `expire_timestamp` (String) The expiration timestamp in YYYY-MM-DDThh:mm:ssZ format
55-
- `row_limit` (Number) The export row limit for exporter role
56-
- `schema` (String) The accessible schema in the database
57-
- `tables` (Set of String) The accessible table list
58-
5938

docs/resources/user.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ The user resource.
2424

2525
- `password` (String, Sensitive) The user login password.
2626
- `phone` (String) The user phone.
27-
- `roles` (Set of String) The user's roles in the workspace level
2827
- `type` (String) The user type.
2928

3029
### Read-Only

examples/database/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
terraform {
33
required_providers {
44
bytebase = {
5-
version = "1.0.22"
5+
version = "1.0.23"
66
# For local development, please use "terraform.local/bytebase/bytebase" instead
77
source = "registry.terraform.io/bytebase/bytebase"
88
}

examples/environments/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
terraform {
33
required_providers {
44
bytebase = {
5-
version = "1.0.22"
5+
version = "1.0.23"
66
# For local development, please use "terraform.local/bytebase/bytebase" instead
77
source = "registry.terraform.io/bytebase/bytebase"
88
}

examples/groups/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
terraform {
22
required_providers {
33
bytebase = {
4-
version = "1.0.22"
4+
version = "1.0.23"
55
# For local development, please use "terraform.local/bytebase/bytebase" instead
66
source = "registry.terraform.io/bytebase/bytebase"
77
}

examples/iamPolicy/main.tf

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
terraform {
2+
required_providers {
3+
bytebase = {
4+
version = "1.0.23"
5+
# For local development, please use "terraform.local/bytebase/bytebase" instead
6+
source = "registry.terraform.io/bytebase/bytebase"
7+
}
8+
}
9+
}
10+
11+
provider "bytebase" {
12+
# You need to replace the account and key with your Bytebase service account.
13+
service_account = "[email protected]"
14+
service_key = "bbs_BxVIp7uQsARl8nR92ZZV"
15+
# The Bytebase service URL. You can use the external URL in production.
16+
# Check the docs about external URL: https://www.bytebase.com/docs/get-started/install/external-url
17+
url = "https://bytebase.example.com"
18+
}
19+
20+
data "bytebase_iam_policy" "workspace_iam" {
21+
parent = "workspaces/-"
22+
}
23+
24+
output "workspace_iam" {
25+
value = data.bytebase_iam_policy.workspace_iam
26+
}
27+
28+
data "bytebase_iam_policy" "project_iam" {
29+
parent = "projects/project-sample"
30+
}
31+
32+
output "project_iam" {
33+
value = data.bytebase_iam_policy.project_iam
34+
}

examples/instances/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
terraform {
33
required_providers {
44
bytebase = {
5-
version = "1.0.22"
5+
version = "1.0.23"
66
# For local development, please use "terraform.local/bytebase/bytebase" instead
77
source = "registry.terraform.io/bytebase/bytebase"
88
}

examples/policies/main.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
terraform {
22
required_providers {
33
bytebase = {
4-
version = "1.0.22"
4+
version = "1.0.23"
55
# For local development, please use "terraform.local/bytebase/bytebase" instead
66
source = "registry.terraform.io/bytebase/bytebase"
77
}
@@ -27,7 +27,8 @@ output "masking_exception_policy" {
2727
}
2828

2929
data "bytebase_policy" "global_masking_policy" {
30-
type = "MASKING_RULE"
30+
parent = "workspaces/-"
31+
type = "MASKING_RULE"
3132
}
3233

3334
output "global_masking_policy" {

examples/projects/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
terraform {
33
required_providers {
44
bytebase = {
5-
version = "1.0.22"
5+
version = "1.0.23"
66
# For local development, please use "terraform.local/bytebase/bytebase" instead
77
source = "registry.terraform.io/bytebase/bytebase"
88
}

examples/roles/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
terraform {
22
required_providers {
33
bytebase = {
4-
version = "1.0.22"
4+
version = "1.0.23"
55
# For local development, please use "terraform.local/bytebase/bytebase" instead
66
source = "registry.terraform.io/bytebase/bytebase"
77
}

examples/settings/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
terraform {
22
required_providers {
33
bytebase = {
4-
version = "1.0.22"
4+
version = "1.0.23"
55
# For local development, please use "terraform.local/bytebase/bytebase" instead
66
source = "registry.terraform.io/bytebase/bytebase"
77
}

0 commit comments

Comments
 (0)