diff --git a/CHANGELOG.md b/CHANGELOG.md index ac601d628..4782fcab0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Enhancements * Adds `ProjectRemoteState` field to `Workspace` to support state sharing at the project level, by @hs26gill [#1248](https://github.com/hashicorp/go-tfe/pull/1248) +* Adds 'Migration' field to `StackCreateOptions` and `CreationSource` to stack struct to provide insights re: stack creation [#1266](https://github.com/hashicorp/go-tfe/pull/1266) # v1.98.0 diff --git a/stack.go b/stack.go index 4685c2a2e..563e24ef6 100644 --- a/stack.go +++ b/stack.go @@ -94,6 +94,7 @@ type Stack struct { DownstreamCount int `jsonapi:"attr,downstream-count"` InputsCount int `jsonapi:"attr,inputs-count"` OutputsCount int `jsonapi:"attr,outputs-count"` + CreationSource string `jsonapi:"attr,creation-source"` // Relationships Project *Project `jsonapi:"relation,project"` @@ -159,6 +160,7 @@ type StackListOptions struct { type StackCreateOptions struct { Type string `jsonapi:"primary,stacks"` Name string `jsonapi:"attr,name"` + Migration *bool `jsonapi:"attr,migration,omitempty"` Description *string `jsonapi:"attr,description,omitempty"` VCSRepo *StackVCSRepoOptions `jsonapi:"attr,vcs-repo"` Project *Project `jsonapi:"relation,project"` diff --git a/stack_integration_test.go b/stack_integration_test.go index 0dda3dc3a..80a6263ab 100644 --- a/stack_integration_test.go +++ b/stack_integration_test.go @@ -38,6 +38,7 @@ func TestStackCreateAndList(t *testing.T) { Project: &Project{ ID: orgTest.DefaultProject.ID, }, + Migration: Bool(true), }) require.NoError(t, err) @@ -64,6 +65,8 @@ func TestStackCreateAndList(t *testing.T) { require.NoError(t, err) assert.Len(t, stackList.Items, 2) + assert.Equal(t, stack1.CreationSource, "migration-api") + assert.Equal(t, stack2.CreationSource, "api") }) t.Run("List with project filter", func(t *testing.T) {