Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue default_value and help_text unexpected new value #760

Merged
merged 1 commit into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions octopusdeploy_framework/resource_library_variable_set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,13 @@ func testLibraryVariableSetWithVariable(localName, variableLocalName, name, desc
resource "octopusdeploy_library_variable_set" "%s" {
name = "%s"
description = "%s"

template {
name = "template"
# help_text = ""
default_value = ""
display_settings = { "Octopus.ControlType" = "SingleLineText" }
}
}

resource "octopusdeploy_variable" "%s" {
Expand Down
5 changes: 5 additions & 0 deletions octopusdeploy_framework/schemas/action_template_parameter.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/hashicorp/terraform-plugin-framework/attr"
resourceSchema "github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
"github.com/hashicorp/terraform-plugin-framework/types"
Expand Down Expand Up @@ -72,6 +73,8 @@ func GetActionTemplateParameterSchema() map[string]resourceSchema.Attribute {
"default_value": resourceSchema.StringAttribute{
Description: "A default value for the parameter, if applicable. This can be a hard-coded value or a variable reference.",
Optional: true,
Computed: true,
Default: stringdefault.StaticString(""),
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
Expand All @@ -84,6 +87,8 @@ func GetActionTemplateParameterSchema() map[string]resourceSchema.Attribute {
"help_text": resourceSchema.StringAttribute{
Description: "The help presented alongside the parameter input.",
Optional: true,
Computed: true,
Default: stringdefault.StaticString(""),
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
Expand Down
2 changes: 1 addition & 1 deletion octopusdeploy_framework/schemas/library_variable_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func FlattenTemplates(actionTemplateParameters []actiontemplates.ActionTemplateP

for _, actionTemplateParams := range actionTemplateParameters {
attrs := map[string]attr.Value{
"default_value": util.Ternary(actionTemplateParams.DefaultValue.Value != "", types.StringValue(actionTemplateParams.DefaultValue.Value), types.StringNull()),
"default_value": types.StringValue(actionTemplateParams.DefaultValue.Value),
"display_settings": flattenDisplaySettingsMap(actionTemplateParams.DisplaySettings),
"help_text": util.Ternary(actionTemplateParams.HelpText != "", types.StringValue(actionTemplateParams.HelpText), types.StringValue("")),
"id": types.StringValue(actionTemplateParams.GetID()),
Expand Down
Loading