Skip to content

Commit

Permalink
Workspace Variables Support (#30)
Browse files Browse the repository at this point in the history
* Workspace Variables Support
  • Loading branch information
alfespa17 authored May 1, 2024
1 parent 83cd21b commit 05b56fb
Show file tree
Hide file tree
Showing 5 changed files with 428 additions and 0 deletions.
31 changes: 31 additions & 0 deletions docs/resources/workspace_variable.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_variable Resource - terraform-provider-terrakube"
subcategory: ""
description: |-
---

# terrakube_workspace_variable (Resource)





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

### Required

- `category` (String) Variable category (ENV or TERRAFORM)
- `description` (String) Variable description
- `hcl` (Boolean) is hcl?
- `key` (String) Variable key
- `organization_id` (String) Terrakube organization id
- `sensitive` (Boolean) is sensitive?
- `value` (String) Variable value
- `workspace_id` (String) Terrakube workspace id

### Read-Only

- `id` (String) Variable Id
21 changes: 21 additions & 0 deletions examples/resources/workspace_variable/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
resource "terrakube_workspace_variable" "sample1" {
organization_id = data.terrakube_organization.org.id
workspace_id = terrakube_workspace_cli.sample1.id
key = "sample-env-var"
value = "sample-value2222"
description = "sample env var"
category = "ENV"
sensitive = false
hcl = false
}

resource "terrakube_workspace_variable" "sample2" {
organization_id = data.terrakube_organization.org.id
workspace_id = terrakube_workspace_cli.sample1.id
key = "sample-terra-var"
value = "sample-TERRAFORM"
description = "sample env var"
category = "TERRAFORM"
sensitive = false
hcl = false
}
10 changes: 10 additions & 0 deletions internal/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ type WorkspaceEntity struct {
Deleted bool `jsonapi:"attr,deleted"`
}

type WorkspaceVariableEntity struct {
ID string `jsonapi:"primary,variable"`
Key string `jsonapi:"attr,key"`
Value string `jsonapi:"attr,value"`
Description string `jsonapi:"attr,description"`
Category string `jsonapi:"attr,category"`
Sensitive bool `jsonapi:"attr,sensitive"`
Hcl bool `jsonapi:"attr,hcl"`
}

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 @@ -172,6 +172,7 @@ func (p *TerrakubeProvider) Resources(ctx context.Context) []func() resource.Res
NewModuleResource,
NewOrganizationResource,
NewWorkspaceCliResource,
NewWorkspaceVariableResource,
}
}

Expand Down
Loading

0 comments on commit 05b56fb

Please sign in to comment.