Skip to content

Commit

Permalink
Add support workspace_vcs resource (#44)
Browse files Browse the repository at this point in the history
* Add support workspace_vcs resource
  • Loading branch information
alfespa17 authored Jul 9, 2024
1 parent 2061ee3 commit c2fa361
Show file tree
Hide file tree
Showing 5 changed files with 466 additions and 2 deletions.
31 changes: 31 additions & 0 deletions docs/resources/workspace_vcs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "terrakube_workspace_vcs Resource - terraform-provider-terrakube"
subcategory: ""
description: |-
---

# terrakube_workspace_vcs (Resource)





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

### Required

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

### Read-Only

- `id` (String) Workspace CLI Id
10 changes: 10 additions & 0 deletions examples/resources/workspace_vcs_resource/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
resource "terrakube_workspace_cli" "sample1" {
organization_id = data.terrakube_organization.org.id
name = "work-from-provider1"
description = "sample"
execution_mode = "remote"
repository = "https://github.com/AzBuilder/terrakube-docker-compose.git"
branch = "main"
iac_type = "terraform"
iac_version = "1.5.7"
}
1 change: 1 addition & 0 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ func (p *TerrakubeProvider) Resources(ctx context.Context) []func() resource.Res
NewModuleResource,
NewOrganizationResource,
NewWorkspaceCliResource,
NewWorkspaceVcsResource,
NewWorkspaceVariableResource,
NewOrganizationVariableResource,
}
Expand Down
4 changes: 2 additions & 2 deletions internal/provider/workspace_cli_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,13 +387,13 @@ func (r *WorkspaceCliResource) Delete(ctx context.Context, req resource.DeleteRe
workspaceCliRequest.Header.Add("Authorization", fmt.Sprintf("Bearer %s", r.token))
workspaceCliRequest.Header.Add("Content-Type", "application/vnd.api+json")
if err != nil {
resp.Diagnostics.AddError("Error creating team resource request", fmt.Sprintf("Error creating team resource request: %s", err))
resp.Diagnostics.AddError("Error creating cli resource request", fmt.Sprintf("Error creating cli resource request: %s", err))
return
}

workspaceCliResponse, err := r.client.Do(workspaceCliRequest)
if err != nil {
resp.Diagnostics.AddError("Error executing team resource request", fmt.Sprintf("Error executing team resource request: %s", err))
resp.Diagnostics.AddError("Error executing cli resource request", fmt.Sprintf("Error executing cli resource request: %s", err))
return
}

Expand Down
Loading

0 comments on commit c2fa361

Please sign in to comment.