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: set default empty list for prefect_variable.tags #115

Merged
merged 1 commit into from
Nov 7, 2023

Conversation

parkedwards
Copy link
Contributor

resolves #110

with this configuration:

resource "prefect_variable" "example" {
  name  = "my_variable"
  value = "variable value goes here"
  workspace_id = data.prefect_workspace.evergreen.id
}

this is the plan that is generated (and applies successfully)

image

adding new tags, modifying tags, and resetting the resource to be tag-less all apply correctly

@parkedwards parkedwards requested a review from a team as a code owner November 7, 2023 22:56
@@ -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),
Copy link
Contributor Author

@parkedwards parkedwards Nov 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this is a list type, there are these special constructors you need to use to set default values here

https://developer.hashicorp.com/terraform/plugin/framework/handling-data/attributes/list#plan-modification

@parkedwards parkedwards changed the title fix: set default empty value for prefect_variable.tags fix: set default empty list for prefect_variable.tags Nov 7, 2023
@parkedwards parkedwards changed the title fix: set default empty list for prefect_variable.tags fix: set default empty list for prefect_variable.tags Nov 7, 2023
@parkedwards parkedwards merged commit 6d42153 into main Nov 7, 2023
@parkedwards parkedwards deleted the fix/variable-tags branch November 7, 2023 23:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error when creating a prefect_variable, issue with tags
2 participants