Skip to content

Commit ec45715

Browse files
authored
Add support for global variables (#33)
* Add support for global variables
1 parent dc480e5 commit ec45715

File tree

7 files changed

+449
-1
lines changed

7 files changed

+449
-1
lines changed

README.md

+20
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,26 @@ resource "terrakube_organization" "org_sample" {
4444
execution_mode = "local"
4545
}
4646
47+
resource "terrakube_organization_variable" "sample1" {
48+
organization_id = data.terrakube_organization.org.id
49+
key = "sample-env-var"
50+
value = "sample-var2"
51+
description = "sample env var2213241243"
52+
category = "ENV"
53+
sensitive = false
54+
hcl = false
55+
}
56+
57+
resource "terrakube_organization_variable" "sample2" {
58+
organization_id = data.terrakube_organization.org.id
59+
key = "sample-terra-var"
60+
value = "sample-terraform234"
61+
description = "sample env var222212341234"
62+
category = "TERRAFORM"
63+
sensitive = false
64+
hcl = false
65+
}
66+
4767
data "terrakube_organization" "org" {
4868
name = "simple"
4969
}
+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "terrakube_organization_variable Resource - terraform-provider-terrakube"
4+
subcategory: ""
5+
description: |-
6+
7+
---
8+
9+
# terrakube_organization_variable (Resource)
10+
11+
12+
13+
14+
15+
<!-- schema generated by tfplugindocs -->
16+
## Schema
17+
18+
### Required
19+
20+
- `category` (String) Variable category (ENV or TERRAFORM)
21+
- `description` (String) Variable description
22+
- `hcl` (Boolean) is hcl?
23+
- `key` (String) Variable key
24+
- `organization_id` (String) Terrakube organization id
25+
- `sensitive` (Boolean) is sensitive?
26+
- `value` (String) Variable value
27+
28+
### Read-Only
29+
30+
- `id` (String) Variable Id
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
resource "terrakube_organization_variable" "sample1" {
2+
organization_id = data.terrakube_organization.org.id
3+
key = "sample-env-var"
4+
value = "sample-var2"
5+
description = "sample env var2213241243"
6+
category = "ENV"
7+
sensitive = false
8+
hcl = false
9+
}
10+
11+
resource "terrakube_organization_variable" "sample2" {
12+
organization_id = data.terrakube_organization.org.id
13+
key = "sample-terra-var"
14+
value = "sample-terraform234"
15+
description = "sample env var222212341234"
16+
category = "TERRAFORM"
17+
sensitive = false
18+
hcl = false
19+
}

internal/client/client.go

+10
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ type WorkspaceVariableEntity struct {
4545
Hcl bool `jsonapi:"attr,hcl"`
4646
}
4747

48+
type OrganizationVariableEntity struct {
49+
ID string `jsonapi:"primary,globalvar"`
50+
Key string `jsonapi:"attr,key"`
51+
Value string `jsonapi:"attr,value"`
52+
Description string `jsonapi:"attr,description"`
53+
Category string `jsonapi:"attr,category"`
54+
Sensitive *bool `jsonapi:"attr,sensitive,omitempty"`
55+
Hcl bool `jsonapi:"attr,hcl"`
56+
}
57+
4858
type VcsEntity struct {
4959
ID string `jsonapi:"primary,vcs"`
5060
Name string `jsonapi:"attr,name"`

0 commit comments

Comments
 (0)