Skip to content

Commit

Permalink
Add support to create cli driven workflow workspaces
Browse files Browse the repository at this point in the history
  • Loading branch information
alfespa17 committed May 1, 2024
1 parent c35464d commit 6de5199
Show file tree
Hide file tree
Showing 5 changed files with 455 additions and 0 deletions.
29 changes: 29 additions & 0 deletions docs/resources/workspace_cli.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "terrakube_workspace_cli Resource - terraform-provider-terrakube"
subcategory: ""
description: |-
---

# terrakube_workspace_cli (Resource)





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

### Required

- `description` (String) Workspace CLI description
- `execution_mode` (String) Workspace CLI execution mode (remote or local)
- `iac_type` (String) Workspace CLI IaC type (Supported values terraform or tofu)
- `iac_version` (String) Workspace CLI IaC type
- `name` (String) Workspace CLI name
- `organization_id` (String) Terrakube organization id

### Read-Only

- `id` (String) Workspace CLI Id
17 changes: 17 additions & 0 deletions examples/resources/workspace_cli_resource/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
resource "terrakube_workspace_cli" "sample1" {
organization_id = data.terrakube_organization.org.id
name = "work-from-provider1"
description = "sample"
execution_mode = "remote"
iac_type = "terraform"
iac_version = "1.5.7"
}

resource "terrakube_workspace_cli" "sample2" {
organization_id = data.terrakube_organization.org.id
name = "work-from-provider2"
description = "sample"
execution_mode = "local"
iac_type = "tofu"
iac_version = "1.7.0"
}
13 changes: 13 additions & 0 deletions internal/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,19 @@ type TeamEntity struct {
ManageTemplate bool `jsonapi:"attr,manageTemplate"`
}

type WorkspaceEntity struct {
ID string `jsonapi:"primary,workspace"`
Name string `jsonapi:"attr,name"`
Description string `jsonapi:"attr,description"`
Source string `jsonapi:"attr,source"`
Branch string `jsonapi:"attr,branch"`
Folder string `jsonapi:"attr,folder"`
IaCType string `jsonapi:"attr,iacType"`
IaCVersion string `jsonapi:"attr,terraformVersion"`
ExecutionMode string `jsonapi:"attr,executionMode"`
Deleted bool `jsonapi:"attr,deleted"`
}

type VcsEntity struct {
ID string `jsonapi:"primary,vcs"`
Name string `jsonapi:"attr,name"`
Expand Down
1 change: 1 addition & 0 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ func (p *TerrakubeProvider) Resources(ctx context.Context) []func() resource.Res
NewTeamResource,
NewModuleResource,
NewOrganizationResource,
NewWorkspaceCliResource,
}
}

Expand Down
Loading

0 comments on commit 6de5199

Please sign in to comment.