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

Adding missing Category to VariableUpdateOptions #397

Merged
merged 1 commit into from May 12, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions variable.go
Expand Up @@ -114,6 +114,9 @@ type VariableUpdateOptions struct {
// The description of the variable.
Description *string `jsonapi:"attr,description,omitempty"`

// Whether this is a Terraform or environment variable.
Category *CategoryType `jsonapi:"attr,category,omitempty"`

// Whether to evaluate the value of the variable as a string of HCL code.
HCL *bool `jsonapi:"attr,hcl,omitempty"`

Expand Down
12 changes: 12 additions & 0 deletions variable_integration_test.go
Expand Up @@ -278,6 +278,18 @@ func TestVariablesUpdate(t *testing.T) {
assert.Empty(t, v.Value) // Because its now sensitive
})

t.Run("with category set", func(t *testing.T) {
category := CategoryEnv
options := VariableUpdateOptions{
Category: &category,
}

v, err := client.Variables.Update(ctx, vTest.Workspace.ID, vTest.ID, options)
require.NoError(t, err)

assert.Equal(t, *options.Category, v.Category)
})

t.Run("without any changes", func(t *testing.T) {
vTest, vTestCleanup := createVariable(t, client, nil)
defer vTestCleanup()
Expand Down