Skip to content

Commit aaac10a

Browse files
authored
Merge pull request #12 from CruGlobal/data-sources
feat(data): Adding Data Sources
2 parents 4e7250f + 8643426 commit aaac10a

File tree

81 files changed

+4796
-1292
lines changed

Some content is hidden

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

81 files changed

+4796
-1292
lines changed

.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Enable Task environment variable precedence (env defined in taskfile take precedence over OS level env)
2+
# https://taskfile.dev/experiments/env-precedence
3+
TASK_X_ENV_PRECEDENCE=1

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@ The [SemaphoreUI Provider](https://registry.terraform.io/providers/CruGlobal/sem
44

55
This project uses Conventional Commits in order to automatically manage releases as well as keeping the CHANGELOG.md updated. CHANGELOG follows the Keep a Changelog spec.
66

7-
## WARNING
8-
This provider requires changes to SemaphoreUI API which are not yet released. It will not function until those changes have been released. https://github.com/semaphoreui/semaphore/pull/2553
9-
Changes are currently in the `develop` branch of the SemaphoreUI project.
10-
7+
### Requirements
8+
This provider requires an installation of SemaphoreUI running at least version v2.11.2.
119

1210
### SemaphoreUI API Client
1311
The SemaphoreUI API client is generated from the Swagger (OpenAPI-2.0) [api-docs.yml](https://github.com/semaphoreui/semaphore/blob/develop/api-docs.yml) using [go-swagger](https://goswagger.io/go-swagger/).

Taskfile.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ tasks:
3232
client:
3333
desc: Generate the SemaphoreUI API client code
3434
cmds:
35-
- swagger generate client -f https://raw.githubusercontent.com/semaphoreui/semaphore/refs/heads/develop/api-docs.yml -t semaphoreui -A SemaphoreUI --default-scheme=https
35+
- swagger generate client -f https://raw.githubusercontent.com/semaphoreui/semaphore/refs/tags/v2.11.2/api-docs.yml -t semaphoreui -A SemaphoreUI --default-scheme=https
3636

3737
test:
3838
desc: Run unit tests
@@ -60,6 +60,7 @@ tasks:
6060
SEMAPHOREUI_PROTOCOL: http
6161
SEMAPHOREUI_API_TOKEN: "{{.API_TOKEN}}"
6262
TF_ACC: 1
63+
silent: true
6364
cmds:
6465
- task: docker:start
6566
- defer: task docker:stop

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ services:
1414
MYSQL_PASSWORD: semaphore
1515
semaphore:
1616
container_name: semaphore
17-
image: semaphoreui/semaphore:develop
17+
image: semaphoreui/semaphore:v2.11.2
1818
ports:
1919
- "13000:3000"
2020
environment:

docs/data-sources/project.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "semaphoreui_project Data Source - semaphoreui"
4+
subcategory: ""
5+
description: |-
6+
The project data source allows you to read a project in SemaphoreUI.
7+
---
8+
9+
# semaphoreui_project (Data Source)
10+
11+
The project data source allows you to read a project in SemaphoreUI.
12+
13+
## Example Usage
14+
15+
```terraform
16+
# Lookup by Project ID
17+
data "semaphoreui_project" "project" {
18+
id = 1
19+
}
20+
21+
# Lookup by Project Name
22+
data "semaphoreui_project" "example" {
23+
name = "Example Project"
24+
}
25+
```
26+
27+
<!-- schema generated by tfplugindocs -->
28+
## Schema
29+
30+
### Optional
31+
32+
- `id` (Number) The ID of the project. Ensure that one and only one attribute from this collection is set : `id`, `name`.
33+
- `name` (String) Project name. Ensure that one and only one attribute from this collection is set : `id`, `name`.
34+
35+
### Read-Only
36+
37+
- `alert` (Boolean) Allow alerts for this project.
38+
- `alert_chat` (String) Telegram chat ID.
39+
- `created` (String) Creation date of the project.
40+
- `max_parallel_tasks` (Number) Maximum number of parallel tasks, `0` for unlimited.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "semaphoreui_project_environment Data Source - semaphoreui"
4+
subcategory: ""
5+
description: |-
6+
The project environment (variable group) data source allows you to read project environment details.
7+
---
8+
9+
# semaphoreui_project_environment (Data Source)
10+
11+
The project environment (variable group) data source allows you to read project environment details.
12+
13+
## Example Usage
14+
15+
```terraform
16+
data "semaphoreui_project_environment" "environment" {
17+
project_id = 1
18+
id = 4
19+
}
20+
```
21+
22+
<!-- schema generated by tfplugindocs -->
23+
## Schema
24+
25+
### Required
26+
27+
- `id` (Number) The environment ID.
28+
- `project_id` (Number) The project ID that the environment belongs to.
29+
30+
### Read-Only
31+
32+
- `environment` (Map of String) Environment variables.
33+
- `name` (String) The display name of the environment.
34+
- `secrets` (Attributes List) Secret variables of either `"var"` or `"env"` type. The `value` is encrypted and will be empty if imported. (see [below for nested schema](#nestedatt--secrets))
35+
- `variables` (Map of String) Extra variables. Passed to Ansible as extra variables (`--extra-vars`) and Terraform/OpenTofu as variables (`-var`).
36+
37+
<a id="nestedatt--secrets"></a>
38+
### Nested Schema for `secrets`
39+
40+
Read-Only:
41+
42+
- `id` (Number) The variable ID.
43+
- `name` (String) The variable name.
44+
- `type` (String) The variable type.
45+
- `value` (String, Sensitive) The variable value.
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "semaphoreui_project_inventory Data Source - semaphoreui"
4+
subcategory: ""
5+
description: |-
6+
The project inventory data source allows you to read the Ansible inventory or a Terraform/OpenTofu workspace for a project.
7+
---
8+
9+
# semaphoreui_project_inventory (Data Source)
10+
11+
The project inventory data source allows you to read the Ansible inventory or a Terraform/OpenTofu workspace for a project.
12+
13+
## Example Usage
14+
15+
```terraform
16+
# Lookup by Inventory ID
17+
data "semaphoreui_project_inventory" "inventory" {
18+
project_id = 1
19+
id = 2
20+
}
21+
22+
# Lookup by Inventory Name
23+
data "semaphoreui_project_inventory" "example" {
24+
project_id = 1
25+
name = "Example Invewntory"
26+
}
27+
```
28+
29+
<!-- schema generated by tfplugindocs -->
30+
## Schema
31+
32+
### Required
33+
34+
- `project_id` (Number) The project ID that the inventory belongs to.
35+
36+
### Optional
37+
38+
- `id` (Number) The inventory ID. Ensure that one and only one attribute from this collection is set : `id`, `name`.
39+
- `name` (String) The display name of the inventory or workspace. Ensure that one and only one attribute from this collection is set : `id`, `name`.
40+
41+
### Read-Only
42+
43+
- `file` (Attributes) Inventory File. (see [below for nested schema](#nestedatt--file))
44+
- `ssh_key_id` (Number) The Project Key ID to use for accessing hosts in the inventory. This attribute is required for all inventory types in SemaphoreUI. You should set it to the ID of a Key of type `none` if the inventory doesn't require credentials, or for Workspace type inventories.
45+
- `static` (Attributes) Static Inventory. (see [below for nested schema](#nestedatt--static))
46+
- `static_yaml` (Attributes) Static YAML Inventory. (see [below for nested schema](#nestedatt--static_yaml))
47+
- `terraform_workspace` (Attributes) Terraform Workspace. (see [below for nested schema](#nestedatt--terraform_workspace))
48+
49+
<a id="nestedatt--file"></a>
50+
### Nested Schema for `file`
51+
52+
Read-Only:
53+
54+
- `become_key_id` (Number) The Project Key ID to use for privilege escalation (sudo) on hosts in the inventory. Only accepts `password` type Keys.
55+
- `path` (String) The path to the inventory file, relative to the Template or custom Repository. Example: `folder/hosts.yml`.
56+
- `repository_id` (Number) The ID of the Repository that contains the inventory file.
57+
58+
59+
<a id="nestedatt--static"></a>
60+
### Nested Schema for `static`
61+
62+
Read-Only:
63+
64+
- `become_key_id` (Number) The Project Key ID to use for privilege escalation (sudo) on hosts in the inventory. Only accepts `password` type Keys.
65+
- `inventory` (String) Static inventory content in INI format.
66+
67+
68+
<a id="nestedatt--static_yaml"></a>
69+
### Nested Schema for `static_yaml`
70+
71+
Read-Only:
72+
73+
- `become_key_id` (Number) The Project Key ID to use for privilege escalation (sudo) on hosts in the inventory. Only accepts `password` type Keys.
74+
- `inventory` (String) Static inventory content in YAML format.
75+
76+
77+
<a id="nestedatt--terraform_workspace"></a>
78+
### Nested Schema for `terraform_workspace`
79+
80+
Read-Only:
81+
82+
- `workspace` (String) The Terraform workspace name.

docs/data-sources/project_key.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "semaphoreui_project_key Data Source - semaphoreui"
4+
subcategory: ""
5+
description: |-
6+
The project key data source allows you to read the the credentials used throughout a project.
7+
---
8+
9+
# semaphoreui_project_key (Data Source)
10+
11+
The project key data source allows you to read the the credentials used throughout a project.
12+
13+
## Example Usage
14+
15+
```terraform
16+
# Lookup by Key ID
17+
data "semaphoreui_project_key" "key" {
18+
project_id = 1
19+
id = 3
20+
}
21+
22+
# Lookup by Key Name
23+
data "semaphoreui_project_key" "none" {
24+
project_id = 1
25+
name = "None"
26+
}
27+
```
28+
29+
<!-- schema generated by tfplugindocs -->
30+
## Schema
31+
32+
### Required
33+
34+
- `project_id` (Number) The project ID that the key belongs to.
35+
36+
### Optional
37+
38+
- `id` (Number) The key ID. Ensure that one and only one attribute from this collection is set : `id`, `name`.
39+
- `name` (String) The display name of the key. Ensure that one and only one attribute from this collection is set : `id`, `name`.
40+
41+
### Read-Only
42+
43+
- `login_password` (Attributes) A login password key. (see [below for nested schema](#nestedatt--login_password))
44+
- `none` (Attributes) The special None key. (see [below for nested schema](#nestedatt--none))
45+
- `ssh` (Attributes) A SSH key. (see [below for nested schema](#nestedatt--ssh))
46+
47+
<a id="nestedatt--login_password"></a>
48+
### Nested Schema for `login_password`
49+
50+
Read-Only:
51+
52+
- `login` (String) The login username.
53+
- `password` (String, Sensitive) The login password.
54+
55+
56+
<a id="nestedatt--none"></a>
57+
### Nested Schema for `none`
58+
59+
60+
<a id="nestedatt--ssh"></a>
61+
### Nested Schema for `ssh`
62+
63+
Read-Only:
64+
65+
- `login` (String) The login username.
66+
- `passphrase` (String, Sensitive) The SSH Key passphrase.
67+
- `private_key` (String, Sensitive) The SSH private key.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "semaphoreui_project_repository Data Source - semaphoreui"
4+
subcategory: ""
5+
description: |-
6+
The project repository data source allows you to read a repository.
7+
---
8+
9+
# semaphoreui_project_repository (Data Source)
10+
11+
The project repository data source allows you to read a repository.
12+
13+
## Example Usage
14+
15+
```terraform
16+
# Lookup by Repository ID
17+
data "semaphoreui_project_repository" "repo" {
18+
project_id = 1
19+
id = 3
20+
}
21+
22+
# Lookup by Repository Name
23+
data "semaphoreui_project_repository" "semaphore" {
24+
project_id = 1
25+
name = "Semaphore"
26+
}
27+
```
28+
29+
<!-- schema generated by tfplugindocs -->
30+
## Schema
31+
32+
### Required
33+
34+
- `project_id` (Number) The project ID that the repository belongs to.
35+
36+
### Optional
37+
38+
- `id` (Number) The repository ID. Ensure that one and only one attribute from this collection is set : `id`, `name`.
39+
- `name` (String) The display name of the repository. Ensure that one and only one attribute from this collection is set : `id`, `name`.
40+
41+
### Read-Only
42+
43+
- `branch` (String) The branch of the repository to use.
44+
- `ssh_key_id` (Number) The Project Key ID to use for accessing the Git repository.
45+
- `url` (String) The URI or path of the Git repository.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "semaphoreui_project_schedule Data Source - semaphoreui"
4+
subcategory: ""
5+
description: |-
6+
The project schedule data source allows you to read a project schedule
7+
---
8+
9+
# semaphoreui_project_schedule (Data Source)
10+
11+
The project schedule data source allows you to read a project schedule
12+
13+
## Example Usage
14+
15+
```terraform
16+
# Lookup by Schedule ID
17+
data "semaphoreui_project_schedule" "schedule" {
18+
project_id = 1
19+
id = 2
20+
}
21+
```
22+
23+
<!-- schema generated by tfplugindocs -->
24+
## Schema
25+
26+
### Required
27+
28+
- `id` (Number) The schedule ID.
29+
- `project_id` (Number) The project ID that the schedule belongs to.
30+
31+
### Read-Only
32+
33+
- `cron_format` (String) The cron format of the schedule.
34+
- `enabled` (Boolean) Whether the schedule is enabled.
35+
- `name` (String) The display name of the schedule.
36+
- `template_id` (Number) The template ID that the schedule executes.

0 commit comments

Comments
 (0)