Skip to content

Commit

Permalink
fix: set default empty value for prefect_variable.tags (#115)
Browse files Browse the repository at this point in the history
parkedwards authored Nov 7, 2023

Unverified

This user has not yet uploaded their public signing key.
1 parent 411bb10 commit 6d42153
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions internal/provider/resources/variable.go
Original file line number Diff line number Diff line change
@@ -6,13 +6,16 @@ import (
"strings"

"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-framework/attr"
"github.com/hashicorp/terraform-plugin-framework/diag"
"github.com/hashicorp/terraform-plugin-framework/path"
"github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/listdefault"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/types"
"github.com/hashicorp/terraform-plugin-framework/types/basetypes"

"github.com/prefecthq/terraform-provider-prefect/internal/api"
"github.com/prefecthq/terraform-provider-prefect/internal/provider/customtypes"
@@ -74,6 +77,8 @@ func (r *VariableResource) Configure(_ context.Context, req resource.ConfigureRe

// Schema defines the schema for the resource.
func (r *VariableResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
defaultEmptyTagList, _ := basetypes.NewListValue(types.StringType, []attr.Value{})

resp.Schema = schema.Schema{
Description: "Resource representing a Prefect variable",
Version: 0,
@@ -120,6 +125,8 @@ func (r *VariableResource) Schema(_ context.Context, _ resource.SchemaRequest, r
Description: "Tags associated with the variable",
ElementType: types.StringType,
Optional: true,
Computed: true,
Default: listdefault.StaticValue(defaultEmptyTagList),
},
},
}

0 comments on commit 6d42153

Please sign in to comment.