Skip to content

Commit

Permalink
Merge pull request #397 from jtyr/jtyr-varcat
Browse files Browse the repository at this point in the history
Adding missing Category to VariableUpdateOptions
  • Loading branch information
brandonc committed May 12, 2022
2 parents 7ee87d2 + 1a7e0d3 commit e4ea3a7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
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

0 comments on commit e4ea3a7

Please sign in to comment.