diff --git a/variable.go b/variable.go index d72bacaed..53ea17458 100644 --- a/variable.go +++ b/variable.go @@ -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"` diff --git a/variable_integration_test.go b/variable_integration_test.go index 90c0b5722..12ca04bb7 100644 --- a/variable_integration_test.go +++ b/variable_integration_test.go @@ -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()