Skip to content

Add support for migration and creation-source on the Stack Resource#1943

Merged
aaabdelgany merged 4 commits intomainfrom
abdu/stack_creation_source
Jan 8, 2026
Merged

Add support for migration and creation-source on the Stack Resource#1943
aaabdelgany merged 4 commits intomainfrom
abdu/stack_creation_source

Conversation

@aaabdelgany
Copy link
Copy Markdown
Contributor

@aaabdelgany aaabdelgany commented Jan 8, 2026

Description

This PR adds support for the migration flag thats used when creating Stacks as well as the read only creation-source attribute.

The migration flag in the stack resource is only to be used at the time of creation and it isn't serialized at any further point in an api response for that stack. So this PR has to preserve the migration value using the state file to ensure that terraform doesn't panic because it thinks that it lost state.

The creation-source field is a read-only field that is returned as part of an api response for a stack.

Remember to:

Testing plan

resource "tfe_organization" "foobar" {
  name  = "%s"
  email = "admin@tfe.local"
}

resource "tfe_agent_pool" "foobar" {
  name                  = "agent-pool-test-example"
  organization          = tfe_organization.foobar.name
}

resource "tfe_project" "example" {
	name         = "example"
	organization = tfe_organization.foobar.name
}

resource "tfe_oauth_client" "foobar" {
  organization     = tfe_organization.foobar.name
  api_url          = "https://api.github.com"
  http_url         = "https://github.com"
  oauth_token      = "%s"
  service_provider = "github"
}

resource "tfe_stack" "foobar" {
	name        = "example-stack"
	description = "Just an ordinary stack"
  project_id  = tfe_project.example.id
  agent_pool_id = tfe_agent_pool.foobar.id
	migration = true
	vcs_repo {
    identifier         = "%s"
    oauth_token_id     = tfe_oauth_client.foobar.oauth_token_id
  }
}

External links

Include any links here that might be helpful for people reviewing your PR. If there are none, feel free to delete this section.
hashicorp/go-tfe#1266

Output from acceptance tests

Please run applicable acceptance tests locally and include the output here. See testing.md to learn how to run acceptance tests.

If you are an external contributor, your contribution(s) will first be reviewed before running them against the project's CI pipeline.

TF_ACC=1 TF_LOG_SDK_PROTO=OFF go test $(go list ./... |grep -v 'vendor') -v -run TestAccTFEStackResource_basic -timeout 15m
? github.com/hashicorp/terraform-provider-tfe [no test files]
testing: warning: no tests to run
PASS
ok github.com/hashicorp/terraform-provider-tfe/internal/client (cached) [no tests to run]
testing: warning: no tests to run
PASS
ok github.com/hashicorp/terraform-provider-tfe/internal/logging (cached) [no tests to run]
=== RUN TestAccTFEStackResource_basic
--- PASS: TestAccTFEStackResource_basic (14.21s)
PASS
ok github.com/hashicorp/terraform-provider-tfe/internal/provider 15.054s
? github.com/hashicorp/terraform-provider-tfe/internal/provider/helpers [no test files]
? github.com/hashicorp/terraform-provider-tfe/internal/provider/planmodifiers [no test files]
? github.com/hashicorp/terraform-provider-tfe/internal/provider/validators [no test files]
? github.com/hashicorp/terraform-provider-tfe/version [no test files]

...

Rollback Plan

Changes to Security Controls

@aaabdelgany aaabdelgany marked this pull request as ready for review January 8, 2026 20:28
@aaabdelgany aaabdelgany requested a review from a team as a code owner January 8, 2026 20:28
@ctrombley ctrombley force-pushed the abdu/stack_creation_source branch from b0dc0b6 to c18edb4 Compare January 8, 2026 20:45
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 e6840c5 into main Jan 8, 2026
37 of 39 checks passed
@aaabdelgany aaabdelgany deleted the abdu/stack_creation_source branch January 8, 2026 22:13
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