Skip to content

Commit 269df4d

Browse files
committed
Add description to spacelift_mounted_file
Signed-off-by: peterdeme <[email protected]>
1 parent d91d086 commit 269df4d

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

docs/resources/mounted_file.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ resource "spacelift_mounted_file" "core-kubeconfig" {
4646
### Optional
4747

4848
- `context_id` (String) ID of the context on which the mounted file is defined
49+
- `description` (String) Free-form description of the mounted file
4950
- `module_id` (String) ID of the module on which the mounted file is defined
5051
- `stack_id` (String) ID of the stack on which the mounted file is defined
5152
- `write_only` (Boolean) Indicates whether the content can be read back outside a Run. Defaults to `true`.

spacelift/resource_mounted_file.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ func resourceMountedFile() *schema.Resource {
7373
Optional: true,
7474
ForceNew: true,
7575
},
76+
"description": {
77+
Type: schema.TypeString,
78+
Description: "Free-form description of the mounted file",
79+
Optional: true,
80+
ForceNew: true,
81+
},
7682
"write_only": {
7783
Type: schema.TypeBool,
7884
Description: "Indicates whether the content can be read back outside a Run. Defaults to `true`.",
@@ -94,6 +100,10 @@ func resourceMountedFileCreate(ctx context.Context, d *schema.ResourceData, meta
94100
},
95101
}
96102

103+
if desc, ok := d.GetOk("description"); ok {
104+
variables["description"] = desc
105+
}
106+
97107
if contextID, ok := d.GetOk("context_id"); ok {
98108
variables["context"] = toID(contextID)
99109
return resourceMountedFileCreateContext(ctx, d, meta.(*internal.Client), variables)
@@ -195,6 +205,10 @@ func resourceMountedFileRead(ctx context.Context, d *schema.ResourceData, meta i
195205
d.Set("relative_path", relativePath)
196206
d.Set("write_only", element.WriteOnly)
197207

208+
if element.Description != nil {
209+
d.Set("description", *element.Description)
210+
}
211+
198212
if value := element.Value; value != nil {
199213
d.Set("content", *value)
200214
} else {

spacelift/resource_mounted_file_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ func TestMountedFileResource(t *testing.T) {
2626
context_id = spacelift_context.test.id
2727
content = base64encode("bacon is tasty")
2828
relative_path = "bacon.txt"
29+
description = "description text"
2930
write_only = %t
3031
}
3132
`, randomID, writeOnly)
@@ -40,6 +41,7 @@ func TestMountedFileResource(t *testing.T) {
4041
Attribute("checksum", Equals("fb13e7977b7548a324b598e155b5b5ba3dcca2dad5789abe1411a88fa544be9b")),
4142
Attribute("context_id", Contains(randomID)),
4243
Attribute("relative_path", Equals("bacon.txt")),
44+
Attribute("description", Equals("description text")),
4345
Attribute("write_only", Equals("true")),
4446
),
4547
},

0 commit comments

Comments
 (0)