Skip to content

Commit

Permalink
feat: datasources to filter by name
Browse files Browse the repository at this point in the history
feat: datasources to filter by name
  • Loading branch information
stebenz authored Jan 16, 2024
2 parents f579a02 + a81d553 commit f4fef1b
Show file tree
Hide file tree
Showing 59 changed files with 1,155 additions and 69 deletions.
6 changes: 3 additions & 3 deletions acceptance/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3.8'

services:
db:
image: 'cockroachdb/cockroach:v22.2.2'
image: 'cockroachdb/cockroach:v23.1.13'
command: 'start-single-node --insecure --http-addr :9090'
healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:9090/health?ready=1']
Expand All @@ -15,15 +15,15 @@ services:

zitadel:
user: '${ZITADEL_DEV_UID}'
image: '${ZITADEL_IMAGE:-ghcr.io/zitadel/zitadel:v2.38.0}'
image: '${ZITADEL_IMAGE:-ghcr.io/zitadel/zitadel:v2.43.4}'
command: 'start-from-init --masterkey "MasterkeyNeedsToHave32Characters" --tlsMode disabled --config /zitadel.yaml --steps /zitadel.yaml'
ports:
- "8080:8080"
volumes:
- ./keys:/keys
- ./zitadel.yaml:/zitadel.yaml
healthcheck:
test: ['CMD', '/app/zitadel', 'ready']
test: ['CMD', '/app/zitadel', 'ready', "--config", "/zitadel.yaml"]
interval: '2s'
timeout: '30s'
retries: 5
Expand Down
4 changes: 0 additions & 4 deletions docs/data-sources/application_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ data "zitadel_application_api" "default" {
project_id = data.zitadel_project.default.id
app_id = "123456789012345678"
}
output "application_api" {
value = data.zitadel_application_api.default
}
```

<!-- schema generated by tfplugindocs -->
Expand Down
50 changes: 50 additions & 0 deletions docs/data-sources/application_apis.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
page_title: "zitadel_application_apis Data Source - terraform-provider-zitadel"
subcategory: ""
description: |-
Datasource representing an API application belonging to a project, with all configuration possibilities.
---

# zitadel_application_apis (Data Source)

Datasource representing an API application belonging to a project, with all configuration possibilities.

## Example Usage

```terraform
data "zitadel_application_apis" "default" {
org_id = data.zitadel_org.default.id
project_id = data.zitadel_project.default.id
name = "example-name"
name_method = "TEXT_QUERY_METHOD_CONTAINS_IGNORE_CASE"
}
data "zitadel_application_api" "default" {
for_each = toset(data.zitadel_application_apis.default.app_ids)
id = each.value
}
output "app_api_names" {
value = toset([
for app in data.zitadel_application_api.default : app.name
])
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `name` (String) Name of the application
- `project_id` (String) ID of the project

### Optional

- `name_method` (String) Method for querying applications by name, supported values: TEXT_QUERY_METHOD_EQUALS, TEXT_QUERY_METHOD_EQUALS_IGNORE_CASE, TEXT_QUERY_METHOD_STARTS_WITH, TEXT_QUERY_METHOD_STARTS_WITH_IGNORE_CASE, TEXT_QUERY_METHOD_CONTAINS, TEXT_QUERY_METHOD_CONTAINS_IGNORE_CASE, TEXT_QUERY_METHOD_ENDS_WITH, TEXT_QUERY_METHOD_ENDS_WITH_IGNORE_CASE
- `org_id` (String) ID of the organization

### Read-Only

- `app_ids` (List of String) A set of all IDs.
- `id` (String) The ID of this resource.
4 changes: 0 additions & 4 deletions docs/data-sources/application_oidc.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ data "zitadel_application_oidc" "default" {
project_id = data.zitadel_project.default.id
app_id = "123456789012345678"
}
output "application_oidc" {
value = data.zitadel_application_oidc.default
}
```

<!-- schema generated by tfplugindocs -->
Expand Down
50 changes: 50 additions & 0 deletions docs/data-sources/application_oidcs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
page_title: "zitadel_application_oidcs Data Source - terraform-provider-zitadel"
subcategory: ""
description: |-
Datasource representing an OIDC application belonging to a project, with all configuration possibilities.
---

# zitadel_application_oidcs (Data Source)

Datasource representing an OIDC application belonging to a project, with all configuration possibilities.

## Example Usage

```terraform
data "zitadel_application_oidcs" "default" {
org_id = data.zitadel_org.default.id
project_id = data.zitadel_project.default.id
name = "example-name"
name_method = "TEXT_QUERY_METHOD_CONTAINS_IGNORE_CASE"
}
data "zitadel_application_oidc" "default" {
for_each = toset(data.zitadel_application_oidcs.default.app_ids)
id = each.value
}
output "app_oidc_names" {
value = toset([
for app in data.zitadel_application_oidc.default : app.name
])
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `name` (String) Name of the application
- `project_id` (String) ID of the project

### Optional

- `name_method` (String) Method for querying applications by name, supported values: TEXT_QUERY_METHOD_EQUALS, TEXT_QUERY_METHOD_EQUALS_IGNORE_CASE, TEXT_QUERY_METHOD_STARTS_WITH, TEXT_QUERY_METHOD_STARTS_WITH_IGNORE_CASE, TEXT_QUERY_METHOD_CONTAINS, TEXT_QUERY_METHOD_CONTAINS_IGNORE_CASE, TEXT_QUERY_METHOD_ENDS_WITH, TEXT_QUERY_METHOD_ENDS_WITH_IGNORE_CASE
- `org_id` (String) ID of the organization

### Read-Only

- `app_ids` (List of String) A set of all IDs.
- `id` (String) The ID of this resource.
4 changes: 0 additions & 4 deletions docs/data-sources/machine_user.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ data "zitadel_machine_user" "default" {
org_id = data.zitadel_org.default.id
user_id = "123456789012345678"
}
output "machine_user" {
value = data.zitadel_machine_user.default
}
```

<!-- schema generated by tfplugindocs -->
Expand Down
48 changes: 48 additions & 0 deletions docs/data-sources/machine_users.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
page_title: "zitadel_machine_users Data Source - terraform-provider-zitadel"
subcategory: ""
description: |-
Datasource representing a serviceaccount situated under an organization, which then can be authorized through memberships or direct grants on other resources.
---

# zitadel_machine_users (Data Source)

Datasource representing a serviceaccount situated under an organization, which then can be authorized through memberships or direct grants on other resources.

## Example Usage

```terraform
data "zitadel_machine_users" "default" {
org_id = data.zitadel_org.default.id
user_name = "example-name"
user_name_method = "TEXT_QUERY_METHOD_CONTAINS_IGNORE_CASE"
}
data "zitadel_machine_user" "default" {
for_each = toset(data.zitadel_machine_users.default.user_ids)
id = each.value
}
output "user_names" {
value = toset([
for user in data.zitadel_machine_user.default : user.name
])
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `user_name` (String) Username

### Optional

- `org_id` (String) ID of the organization
- `user_name_method` (String) Method for querying machine users by username, supported values: TEXT_QUERY_METHOD_EQUALS, TEXT_QUERY_METHOD_EQUALS_IGNORE_CASE, TEXT_QUERY_METHOD_STARTS_WITH, TEXT_QUERY_METHOD_STARTS_WITH_IGNORE_CASE, TEXT_QUERY_METHOD_CONTAINS, TEXT_QUERY_METHOD_CONTAINS_IGNORE_CASE, TEXT_QUERY_METHOD_ENDS_WITH, TEXT_QUERY_METHOD_ENDS_WITH_IGNORE_CASE

### Read-Only

- `id` (String) The ID of this resource.
- `user_ids` (List of String) A set of all IDs.
28 changes: 23 additions & 5 deletions docs/data-sources/orgs.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "zitadel_orgs Data Source - terraform-provider-zitadel"
subcategory: ""
description: |-
Expand All @@ -10,7 +9,28 @@ description: |-

Datasource representing an organization in ZITADEL, which is the highest level after the instance and contains several other resource including policies if the configuration differs to the default policies on the instance.


## Example Usage

```terraform
data "zitadel_orgs" "default" {
name = "example-name"
name_method = "TEXT_QUERY_METHOD_CONTAINS_IGNORE_CASE"
domain = "example.com"
domain_method = "TEXT_QUERY_METHOD_CONTAINS_IGNORE_CASE"
state = "ORG_STATE_ACTIVE"
}
data "zitadel_org" "default" {
for_each = toset(data.zitadel_orgs.default.ids)
id = each.value
}
output "org_names" {
value = toset([
for org in data.zitadel_org.default : org.name
])
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand All @@ -27,6 +47,4 @@ Datasource representing an organization in ZITADEL, which is the highest level a

- `id` (String) The ID of this resource.
- `ids` (List of String) A set of all organization IDs.
- `primary_domain` (String) Primary domain of the org


- `primary_domain` (String) Primary domain of the org
4 changes: 0 additions & 4 deletions docs/data-sources/project.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ data "zitadel_project" "default" {
org_id = data.zitadel_org.default.id
project_id = "123456789012345678"
}
output "project" {
value = data.zitadel_project.default
}
```

<!-- schema generated by tfplugindocs -->
Expand Down
48 changes: 48 additions & 0 deletions docs/data-sources/projects.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
page_title: "zitadel_projects Data Source - terraform-provider-zitadel"
subcategory: ""
description: |-
Datasource representing the project, which can then be granted to different organizations or users directly, containing different applications.
---

# zitadel_projects (Data Source)

Datasource representing the project, which can then be granted to different organizations or users directly, containing different applications.

## Example Usage

```terraform
data "zitadel_projects" "default" {
org_id = data.zitadel_org.default.id
name = "example-name"
name_method = "TEXT_QUERY_METHOD_CONTAINS_IGNORE_CASE"
}
data "zitadel_project" "default" {
for_each = toset(data.zitadel_projects.default.project_ids)
id = each.value
}
output "project_names" {
value = toset([
for project in data.zitadel_project.default : project.name
])
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `name` (String) Name of the project

### Optional

- `name_method` (String) Method for querying projects by name, supported values: TEXT_QUERY_METHOD_EQUALS, TEXT_QUERY_METHOD_EQUALS_IGNORE_CASE, TEXT_QUERY_METHOD_STARTS_WITH, TEXT_QUERY_METHOD_STARTS_WITH_IGNORE_CASE, TEXT_QUERY_METHOD_CONTAINS, TEXT_QUERY_METHOD_CONTAINS_IGNORE_CASE, TEXT_QUERY_METHOD_ENDS_WITH, TEXT_QUERY_METHOD_ENDS_WITH_IGNORE_CASE
- `org_id` (String) ID of the organization

### Read-Only

- `id` (String) The ID of this resource.
- `project_ids` (List of String) A set of all project IDs.
3 changes: 2 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ terraform {
required_providers {
zitadel = {
source = "zitadel/zitadel"
version = "1.0.3"
version = "1.0.0-alpha.16"
}
}
}
Expand All @@ -40,6 +40,7 @@ provider "zitadel" {
domain = "localhost"
insecure = "true"
port = "8080"
project = "170832731415117995"
jwt_profile_file = "local-token"
}
```
Expand Down
4 changes: 0 additions & 4 deletions examples/provider/data-sources/application_api.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,3 @@ data "zitadel_application_api" "default" {
project_id = data.zitadel_project.default.id
app_id = "123456789012345678"
}

output "application_api" {
value = data.zitadel_application_api.default
}
17 changes: 17 additions & 0 deletions examples/provider/data-sources/application_apis.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
data "zitadel_application_apis" "default" {
org_id = data.zitadel_org.default.id
project_id = data.zitadel_project.default.id
name = "example-name"
name_method = "TEXT_QUERY_METHOD_CONTAINS_IGNORE_CASE"
}

data "zitadel_application_api" "default" {
for_each = toset(data.zitadel_application_apis.default.app_ids)
id = each.value
}

output "app_api_names" {
value = toset([
for app in data.zitadel_application_api.default : app.name
])
}
4 changes: 0 additions & 4 deletions examples/provider/data-sources/application_oidc.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,3 @@ data "zitadel_application_oidc" "default" {
project_id = data.zitadel_project.default.id
app_id = "123456789012345678"
}

output "application_oidc" {
value = data.zitadel_application_oidc.default
}
17 changes: 17 additions & 0 deletions examples/provider/data-sources/application_oidcs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
data "zitadel_application_oidcs" "default" {
org_id = data.zitadel_org.default.id
project_id = data.zitadel_project.default.id
name = "example-name"
name_method = "TEXT_QUERY_METHOD_CONTAINS_IGNORE_CASE"
}

data "zitadel_application_oidc" "default" {
for_each = toset(data.zitadel_application_oidcs.default.app_ids)
id = each.value
}

output "app_oidc_names" {
value = toset([
for app in data.zitadel_application_oidc.default : app.name
])
}
4 changes: 0 additions & 4 deletions examples/provider/data-sources/machine_user.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,3 @@ data "zitadel_machine_user" "default" {
org_id = data.zitadel_org.default.id
user_id = "123456789012345678"
}

output "machine_user" {
value = data.zitadel_machine_user.default
}
Loading

0 comments on commit f4fef1b

Please sign in to comment.