Skip to content

Commit 248a755

Browse files
fix: Mark step template default value as sensitive (#41)
1 parent be65c19 commit 248a755

File tree

8 files changed

+745
-75
lines changed

8 files changed

+745
-75
lines changed

docs/data-sources/step_template.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ Read-Only:
8787

8888
Read-Only:
8989

90+
- `default_sensitive_value` (String)
9091
- `default_value` (String)
9192
- `display_settings` (Map of String)
9293
- `help_text` (String)

docs/resources/step_template.md

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,58 @@ description: |-
1010

1111
This resource manages step_templates in Octopus Deploy.
1212

13-
13+
## Example Usage
14+
15+
```terraform
16+
resource "octopusdeploy_step_template" "example" {
17+
action_type = "Octopus.Script"
18+
name = "Example"
19+
description = "Example script step template"
20+
step_package_id = "Octopus.Script"
21+
packages = [
22+
{
23+
package_id = "my.scripts"
24+
acquisition_location = "Server"
25+
feed_id = module.predefined.feeds.built_in
26+
name = "My Scripts"
27+
properties = {
28+
extract = "True"
29+
purpose = ""
30+
selection_mode = "immediate"
31+
}
32+
}
33+
]
34+
35+
parameters = [
36+
{
37+
name = "Text.Plain"
38+
id = "10001000-0000-0000-0000-100010001001"
39+
label = "Plain text"
40+
help_text = "Random text value"
41+
display_settings = {
42+
"Octopus.ControlType" : "SingleLineText"
43+
}
44+
default_value = "initial text"
45+
},
46+
{
47+
name = "My.Secret"
48+
id = "10001000-0000-0000-0000-100010001002"
49+
label = "Secret value"
50+
help_text = "Some secret value"
51+
display_settings = {
52+
"Octopus.ControlType" : "Sensitive"
53+
}
54+
default_sensitive_value = var.secrets.example
55+
},
56+
]
57+
58+
properties = {
59+
"Octopus.Action.Script.ScriptBody" : "echo '1.#{Text.Plan}'"
60+
"Octopus.Action.Script.ScriptSource" : "Inline"
61+
"Octopus.Action.Script.Syntax" : "Bash"
62+
}
63+
}
64+
```
1465

1566
<!-- schema generated by tfplugindocs -->
1667
## Schema
@@ -79,6 +130,7 @@ Required:
79130

80131
Optional:
81132

133+
- `default_sensitive_value` (String, Sensitive) Use this attribute to set a sensitive default value for the parameter when display settings are set to 'Sensitive'
82134
- `default_value` (String) A default value for the parameter, if applicable. This can be a hard-coded value or a variable reference.
83135
- `display_settings` (Map of String) The display settings for the parameter.
84136
- `help_text` (String) The help presented alongside the parameter input.
@@ -100,4 +152,10 @@ Optional:
100152
- `git_credential_id` (String) ID of an existing Git credential.
101153
- `name` (String) The name of the Git dependency.
102154

155+
## Import
156+
157+
Import is supported using the following syntax:
103158

159+
```shell
160+
terraform import [options] octopusdeploy_step_template.<name> "<template-id>"
161+
```
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
terraform import [options] octopusdeploy_step_template.<name> "<template-id>"
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
resource "octopusdeploy_step_template" "example" {
2+
action_type = "Octopus.Script"
3+
name = "Example"
4+
description = "Example script step template"
5+
step_package_id = "Octopus.Script"
6+
packages = [
7+
{
8+
package_id = "my.scripts"
9+
acquisition_location = "Server"
10+
feed_id = module.predefined.feeds.built_in
11+
name = "My Scripts"
12+
properties = {
13+
extract = "True"
14+
purpose = ""
15+
selection_mode = "immediate"
16+
}
17+
}
18+
]
19+
20+
parameters = [
21+
{
22+
name = "Text.Plain"
23+
id = "10001000-0000-0000-0000-100010001001"
24+
label = "Plain text"
25+
help_text = "Random text value"
26+
display_settings = {
27+
"Octopus.ControlType" : "SingleLineText"
28+
}
29+
default_value = "initial text"
30+
},
31+
{
32+
name = "My.Secret"
33+
id = "10001000-0000-0000-0000-100010001002"
34+
label = "Secret value"
35+
help_text = "Some secret value"
36+
display_settings = {
37+
"Octopus.ControlType" : "Sensitive"
38+
}
39+
default_sensitive_value = var.secrets.example
40+
},
41+
]
42+
43+
properties = {
44+
"Octopus.Action.Script.ScriptBody" : "echo '1.#{Text.Plan}'"
45+
"Octopus.Action.Script.ScriptSource" : "Inline"
46+
"Octopus.Action.Script.Syntax" : "Bash"
47+
}
48+
}

octopusdeploy_framework/datasource_step_template.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func convertStepTemplateAttributes(at *actiontemplates.ActionTemplate) (types.Ob
7171

7272
params := make([]attr.Value, len(at.Parameters))
7373
for i, param := range at.Parameters {
74-
p, dg := convertStepTemplateParameterAttribute(param)
74+
p, dg := convertStepTemplateParameterAttribute(param, nil)
7575
diags.Append(dg...)
7676
params[i] = p
7777
}

0 commit comments

Comments
 (0)