Skip to content

Commit 285031d

Browse files
feat(api-keys): Fix
1 parent a5023c7 commit 285031d

File tree

4 files changed

+220
-0
lines changed

4 files changed

+220
-0
lines changed

examples/resources/spacelift_environment_variable/resource.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ resource "spacelift_environment_variable" "ireland-kubeconfig" {
44
name = "KUBECONFIG"
55
value = "/project/spacelift/kubeconfig"
66
write_only = false
7+
description = "Kubeconfig for Ireland Kubernetes cluster"
78
}
89

910
# For a module
@@ -12,6 +13,7 @@ resource "spacelift_environment_variable" "module-kubeconfig" {
1213
name = "KUBECONFIG"
1314
value = "/project/spacelift/kubeconfig"
1415
write_only = false
16+
description = "Kubeconfig for the module"
1517
}
1618

1719
# For a stack
@@ -20,4 +22,5 @@ resource "spacelift_environment_variable" "core-kubeconfig" {
2022
name = "KUBECONFIG"
2123
value = "/project/spacelift/kubeconfig"
2224
write_only = false
25+
description = "Kubeconfig for the core stack"
2326
}

test/main.tf

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
terraform {
2+
required_providers {
3+
spacelift = {
4+
source = "spacelift.io/spacelift-io/spacelift"
5+
}
6+
}
7+
}
8+
9+
provider "spacelift" {
10+
api_key_endpoint = "http://0michalsokolowski0.app.spacelift.tf"
11+
api_key_id = "01J4VNANTZ2ZN9KMEPJQ55Q9BW"
12+
api_key_secret = "29a1cf3c8b4067bec33adf8724cf7953566ec03a538ea6931604e34ed9c4da9a"
13+
}
14+
15+
data "spacelift_account" "this" {
16+
}
17+
18+
output "account_name" {
19+
value = data.spacelift_account.this.name
20+
}
21+
22+
resource "spacelift_context" "test" {
23+
name = "My first context dupa"
24+
}
25+
26+
resource "spacelift_environment_variable" "test" {
27+
context_id = spacelift_context.test.id
28+
name = "BACON"
29+
value = "is tasty"
30+
write_only = true
31+
description = "Bacon is tasty"
32+
}
33+
34+
data "spacelift_environment_variable" "test" {
35+
context_id = spacelift_environment_variable.test.context_id
36+
name = "BACON"
37+
}
38+
39+
40+
resource "spacelift_environment_variable" "test1" {
41+
context_id = spacelift_context.test.id
42+
name = "NO_DESCRIPTION"
43+
value = "is tasty"
44+
write_only = true
45+
46+
}

test/terraform.tfstate

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"version": 4,
3+
"terraform_version": "1.9.4",
4+
"serial": 13,
5+
"lineage": "526bb5f4-2d15-1d21-39ea-919191802524",
6+
"outputs": {},
7+
"resources": [],
8+
"check_results": null
9+
}

test/terraform.tfstate.backup

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
{
2+
"version": 4,
3+
"terraform_version": "1.9.4",
4+
"serial": 8,
5+
"lineage": "526bb5f4-2d15-1d21-39ea-919191802524",
6+
"outputs": {
7+
"account_name": {
8+
"value": "0michalsokolowski0",
9+
"type": "string"
10+
}
11+
},
12+
"resources": [
13+
{
14+
"mode": "data",
15+
"type": "spacelift_account",
16+
"name": "this",
17+
"provider": "provider[\"spacelift.io/spacelift-io/spacelift\"]",
18+
"instances": [
19+
{
20+
"schema_version": 0,
21+
"attributes": {
22+
"aws_account_id": "017820670266",
23+
"id": "spacelift-account",
24+
"name": "0michalsokolowski0",
25+
"tier": "ENTERPRISE"
26+
},
27+
"sensitive_attributes": []
28+
}
29+
]
30+
},
31+
{
32+
"mode": "data",
33+
"type": "spacelift_environment_variable",
34+
"name": "test",
35+
"provider": "provider[\"spacelift.io/spacelift-io/spacelift\"]",
36+
"instances": [
37+
{
38+
"schema_version": 0,
39+
"attributes": {
40+
"checksum": "4d5d01ea427b10dd483e8fce5b5149fb5a9814e9ee614176b756ca4a65c8f154",
41+
"context_id": "my-first-context-dupa",
42+
"description": "Bacon is tasty",
43+
"id": "context/my-first-context-dupa/BACON",
44+
"module_id": null,
45+
"name": "BACON",
46+
"stack_id": null,
47+
"value": "",
48+
"write_only": true
49+
},
50+
"sensitive_attributes": [
51+
[
52+
{
53+
"type": "get_attr",
54+
"value": "value"
55+
}
56+
]
57+
]
58+
}
59+
]
60+
},
61+
{
62+
"mode": "managed",
63+
"type": "spacelift_context",
64+
"name": "test",
65+
"provider": "provider[\"spacelift.io/spacelift-io/spacelift\"]",
66+
"instances": [
67+
{
68+
"schema_version": 0,
69+
"attributes": {
70+
"after_apply": [],
71+
"after_destroy": [],
72+
"after_init": [],
73+
"after_perform": [],
74+
"after_plan": [],
75+
"after_run": [],
76+
"before_apply": [],
77+
"before_destroy": [],
78+
"before_init": [],
79+
"before_perform": [],
80+
"before_plan": [],
81+
"description": null,
82+
"id": "my-first-context-dupa",
83+
"labels": [],
84+
"name": "My first context dupa",
85+
"space_id": "root"
86+
},
87+
"sensitive_attributes": [],
88+
"private": "bnVsbA=="
89+
}
90+
]
91+
},
92+
{
93+
"mode": "managed",
94+
"type": "spacelift_environment_variable",
95+
"name": "test",
96+
"provider": "provider[\"spacelift.io/spacelift-io/spacelift\"]",
97+
"instances": [
98+
{
99+
"schema_version": 0,
100+
"attributes": {
101+
"checksum": "4d5d01ea427b10dd483e8fce5b5149fb5a9814e9ee614176b756ca4a65c8f154",
102+
"context_id": "my-first-context-dupa",
103+
"description": "Bacon is tasty",
104+
"id": "context/my-first-context-dupa/BACON",
105+
"module_id": null,
106+
"name": "BACON",
107+
"stack_id": null,
108+
"value": "4d5d01ea427b10dd483e8fce5b5149fb5a9814e9ee614176b756ca4a65c8f154",
109+
"write_only": true
110+
},
111+
"sensitive_attributes": [
112+
[
113+
{
114+
"type": "get_attr",
115+
"value": "value"
116+
}
117+
]
118+
],
119+
"private": "bnVsbA==",
120+
"dependencies": [
121+
"spacelift_context.test"
122+
]
123+
}
124+
]
125+
},
126+
{
127+
"mode": "managed",
128+
"type": "spacelift_environment_variable",
129+
"name": "test1",
130+
"provider": "provider[\"spacelift.io/spacelift-io/spacelift\"]",
131+
"instances": [
132+
{
133+
"schema_version": 0,
134+
"attributes": {
135+
"checksum": "4d5d01ea427b10dd483e8fce5b5149fb5a9814e9ee614176b756ca4a65c8f154",
136+
"context_id": "my-first-context-dupa",
137+
"description": "",
138+
"id": "context/my-first-context-dupa/NO_DESCRIPTION",
139+
"module_id": null,
140+
"name": "NO_DESCRIPTION",
141+
"stack_id": null,
142+
"value": "4d5d01ea427b10dd483e8fce5b5149fb5a9814e9ee614176b756ca4a65c8f154",
143+
"write_only": true
144+
},
145+
"sensitive_attributes": [
146+
[
147+
{
148+
"type": "get_attr",
149+
"value": "value"
150+
}
151+
]
152+
],
153+
"private": "bnVsbA==",
154+
"dependencies": [
155+
"spacelift_context.test"
156+
]
157+
}
158+
]
159+
}
160+
],
161+
"check_results": null
162+
}

0 commit comments

Comments
 (0)