Skip to content

Commit 83cd21b

Browse files
authored
Add support to create cli driven workflow workspaces (#29)
* Add support to create cli driven workflow workspaces
1 parent c35464d commit 83cd21b

File tree

5 files changed

+460
-0
lines changed

5 files changed

+460
-0
lines changed

docs/resources/workspace_cli.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "terrakube_workspace_cli Resource - terraform-provider-terrakube"
4+
subcategory: ""
5+
description: |-
6+
7+
---
8+
9+
# terrakube_workspace_cli (Resource)
10+
11+
12+
13+
14+
15+
<!-- schema generated by tfplugindocs -->
16+
## Schema
17+
18+
### Required
19+
20+
- `description` (String) Workspace CLI description
21+
- `execution_mode` (String) Workspace CLI execution mode (remote or local)
22+
- `iac_type` (String) Workspace CLI IaC type (Supported values terraform or tofu)
23+
- `iac_version` (String) Workspace CLI IaC type
24+
- `name` (String) Workspace CLI name
25+
- `organization_id` (String) Terrakube organization id
26+
27+
### Read-Only
28+
29+
- `id` (String) Workspace CLI Id
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
resource "terrakube_workspace_cli" "sample1" {
2+
organization_id = data.terrakube_organization.org.id
3+
name = "work-from-provider1"
4+
description = "sample"
5+
execution_mode = "remote"
6+
iac_type = "terraform"
7+
iac_version = "1.5.7"
8+
}
9+
10+
resource "terrakube_workspace_cli" "sample2" {
11+
organization_id = data.terrakube_organization.org.id
12+
name = "work-from-provider2"
13+
description = "sample"
14+
execution_mode = "local"
15+
iac_type = "tofu"
16+
iac_version = "1.7.0"
17+
}

internal/client/client.go

+13
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,19 @@ type TeamEntity struct {
2222
ManageTemplate bool `jsonapi:"attr,manageTemplate"`
2323
}
2424

25+
type WorkspaceEntity struct {
26+
ID string `jsonapi:"primary,workspace"`
27+
Name string `jsonapi:"attr,name"`
28+
Description string `jsonapi:"attr,description"`
29+
Source string `jsonapi:"attr,source"`
30+
Branch string `jsonapi:"attr,branch"`
31+
Folder string `jsonapi:"attr,folder"`
32+
IaCType string `jsonapi:"attr,iacType"`
33+
IaCVersion string `jsonapi:"attr,terraformVersion"`
34+
ExecutionMode string `jsonapi:"attr,executionMode"`
35+
Deleted bool `jsonapi:"attr,deleted"`
36+
}
37+
2538
type VcsEntity struct {
2639
ID string `jsonapi:"primary,vcs"`
2740
Name string `jsonapi:"attr,name"`

internal/provider/provider.go

+1
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ func (p *TerrakubeProvider) Resources(ctx context.Context) []func() resource.Res
171171
NewTeamResource,
172172
NewModuleResource,
173173
NewOrganizationResource,
174+
NewWorkspaceCliResource,
174175
}
175176
}
176177

0 commit comments

Comments
 (0)