Skip to content

Add migration field to create stack payload and creationsource to the stack struct#1266

Merged
aaabdelgany merged 2 commits intomainfrom
abdu/create_stack_migration_field
Jan 5, 2026
Merged

Add migration field to create stack payload and creationsource to the stack struct#1266
aaabdelgany merged 2 commits intomainfrom
abdu/create_stack_migration_field

Conversation

@aaabdelgany
Copy link
Copy Markdown
Contributor

@aaabdelgany aaabdelgany commented Dec 29, 2025

Description

This PR adds support for the migration boolean flag that can be used when creating a stack. This flag doesn't do anything functionality wise - it's just used to track usage of the stack migration utility. This PR also serializes the creation-source field on the stack model - which is only used to provide insight into how the stack was created.

Testing plan

Set migration to true when creating a stack - and consume a stack to view its creation source.

External links

Output from tests

Including output from tests may require access to a TFE instance. Ignore this section if you have no environment to test against.

go test ./... -v -run TestStackCreateAndList
=== RUN   TestStackCreateAndList
=== RUN   TestStackCreateAndList/List_without_options
=== PAUSE TestStackCreateAndList/List_without_options
=== RUN   TestStackCreateAndList/List_with_project_filter
=== PAUSE TestStackCreateAndList/List_with_project_filter
=== RUN   TestStackCreateAndList/List_with_name_filter
=== PAUSE TestStackCreateAndList/List_with_name_filter
=== RUN   TestStackCreateAndList/List_with_sort_options
=== PAUSE TestStackCreateAndList/List_with_sort_options
=== RUN   TestStackCreateAndList/List_with_pagination
=== PAUSE TestStackCreateAndList/List_with_pagination
=== CONT  TestStackCreateAndList/List_without_options
=== CONT  TestStackCreateAndList/List_with_pagination
=== CONT  TestStackCreateAndList/List_with_name_filter
=== CONT  TestStackCreateAndList/List_with_sort_options
=== CONT  TestStackCreateAndList/List_with_project_filter
--- PASS: TestStackCreateAndList (3.39s)
    --- PASS: TestStackCreateAndList/List_with_name_filter (0.37s)
    --- PASS: TestStackCreateAndList/List_with_pagination (0.38s)
    --- PASS: TestStackCreateAndList/List_without_options (0.41s)
    --- PASS: TestStackCreateAndList/List_with_project_filter (0.41s)
    --- PASS: TestStackCreateAndList/List_with_sort_options (0.57s)
PASS
ok  	github.com/hashicorp/go-tfe	4.525s
?   	github.com/hashicorp/go-tfe/examples/backing_data	[no test files]
?   	github.com/hashicorp/go-tfe/examples/configuration_versions	[no test files]
?   	github.com/hashicorp/go-tfe/examples/organizations	[no test files]
?   	github.com/hashicorp/go-tfe/examples/projects	[no test files]
?   	github.com/hashicorp/go-tfe/examples/registry_modules	[no test files]
?   	github.com/hashicorp/go-tfe/examples/run_errors	[no test files]
?   	github.com/hashicorp/go-tfe/examples/state_versions	[no test files]
?   	github.com/hashicorp/go-tfe/examples/users	[no test files]
?   	github.com/hashicorp/go-tfe/examples/workspaces	[no test files]
?   	github.com/hashicorp/go-tfe/mocks	[no test files]
...

Rollback Plan

Changes to Security Controls

@datadog-terraform-cloud-hashicorp
Copy link
Copy Markdown

datadog-terraform-cloud-hashicorp bot commented Dec 29, 2025

⚠️ Tests

⚠️ Warnings

❄️ 4 New flaky tests detected

TestWorkspacesSafeDelete from workspace_integration_test.go (Datadog)
failed test
TestWorkspacesSafeDelete/when_workspace_has_resources_under_management from workspace_integration_test.go (Datadog)
Workspace still processing after retrying: conflict
Latest workspace state is being processed to discover resources, please try again later
TestWorkspacesSafeDeleteByID from github.com/hashicorp/go-tfe (Datadog)
Failed

=== RUN   TestWorkspacesSafeDeleteByID
--- FAIL: TestWorkspacesSafeDeleteByID (35.66s)
TestWorkspacesSafeDeleteByID/when_workspace_has_resources_under_management from github.com/hashicorp/go-tfe (Datadog)
Failed

=== RUN   TestWorkspacesSafeDeleteByID/when_workspace_has_resources_under_management
    workspace_integration_test.go:2354: Workspace still processing after retrying: conflict
        Latest workspace state is being processed to discover resources, please try again later
--- FAIL: TestWorkspacesSafeDeleteByID/when_workspace_has_resources_under_management (33.09s)
View all

ℹ️ Info

🧪 All tests passed

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 223030a | Docs | Was this helpful? Give us feedback!

@aaabdelgany aaabdelgany marked this pull request as ready for review December 30, 2025 21:56
@aaabdelgany aaabdelgany requested a review from a team as a code owner December 30, 2025 21:56
Copy link
Copy Markdown
Collaborator

@ctrombley ctrombley left a comment

Choose a reason for hiding this comment

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

Looks good!

@aaabdelgany aaabdelgany merged commit 37abe66 into main Jan 5, 2026
28 of 30 checks passed
@aaabdelgany aaabdelgany deleted the abdu/create_stack_migration_field branch January 5, 2026 15:35
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 5, 2026

Reminder to the contributor that merged this PR: if your changes have added important functionality or fixed a relevant bug, open a follow-up PR to update CHANGELOG.md with a note on your changes.

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.

2 participants