Skip to content

implement stacks API method for variable sets#1251

Merged
nithishravindra merged 3 commits intomainfrom
nithish/stacks-varset-api-2
Dec 1, 2025
Merged

implement stacks API method for variable sets#1251
nithishravindra merged 3 commits intomainfrom
nithish/stacks-varset-api-2

Conversation

@nithishravindra
Copy link
Copy Markdown
Member

@nithishravindra nithishravindra commented Nov 24, 2025

Description

implement variable set stacks API

Add complete variable set management for stacks with three new API methods:

  • ApplyToStacks: Apply variable sets to stacks (additive)
  • RemoveFromStacks: Remove variable sets from stacks
  • UpdateStacks: Update the list of stacks a variable set is applied to

Testing plan

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.

ENABLE_BETA=1 TFE_ADDRESS="https://tfcdev-3b6b72c0.ngrok.app" TFE_TOKEN=$TOKEN OAUTH_CLIENT_GITHUB_TOKEN=$GITHUB_TOKEN go test -v -run "TestVariableSetsApplyToAndRemoveFromStacks"
=== RUN   TestVariableSetsApplyToAndRemoveFromStacks
=== RUN   TestVariableSetsApplyToAndRemoveFromStacks/with_first_stack_added
=== RUN   TestVariableSetsApplyToAndRemoveFromStacks/with_second_stack_added
=== RUN   TestVariableSetsApplyToAndRemoveFromStacks/with_first_stack_removed
=== RUN   TestVariableSetsApplyToAndRemoveFromStacks/when_variable_set_ID_is_invalid
=== RUN   TestVariableSetsApplyToAndRemoveFromStacks/when_stack_ID_is_invalid
--- PASS: TestVariableSetsApplyToAndRemoveFromStacks (11.65s)
    --- PASS: TestVariableSetsApplyToAndRemoveFromStacks/with_first_stack_added (0.18s)
    --- PASS: TestVariableSetsApplyToAndRemoveFromStacks/with_second_stack_added (0.17s)
    --- PASS: TestVariableSetsApplyToAndRemoveFromStacks/with_first_stack_removed (0.17s)
    --- PASS: TestVariableSetsApplyToAndRemoveFromStacks/when_variable_set_ID_is_invalid (0.00s)
    --- PASS: TestVariableSetsApplyToAndRemoveFromStacks/when_stack_ID_is_invalid (0.00s)
PASS
ok      github.com/hashicorp/go-tfe     12.683s


ENABLE_BETA=1 TFE_ADDRESS="https://tfcdev-3b6b72c0.ngrok.app" TFE_TOKEN=$TOKEN OAUTH_CLIENT_GITHUB_TOKEN=$GITHUB_TOKEN go test -v -run "TestVariableSetsUpdateStacks"              
=== RUN   TestVariableSetsUpdateStacks
=== RUN   TestVariableSetsUpdateStacks/with_valid_stacks
--- PASS: TestVariableSetsUpdateStacks (6.09s)
    --- PASS: TestVariableSetsUpdateStacks/with_valid_stacks (0.39s)
PASS
ok      github.com/hashicorp/go-tfe     6.320s

Rollback Plan

Changes to Security Controls

@nithishravindra nithishravindra force-pushed the nithish/stacks-varset-api-2 branch from 62cd80b to f14d66c Compare November 24, 2025 07:22
@datadog-terraform-cloud-hashicorp
Copy link
Copy Markdown

datadog-terraform-cloud-hashicorp bot commented Nov 24, 2025

⚠️ Tests

⚠️ Warnings

❄️ 2 New flaky tests detected

TestRunsApply_RunDependent from run_integration_test.go (Datadog)
failed test
TestRunsApply_RunDependent/when_the_run_exists from run_integration_test.go (Datadog)

	Error Trace:	/home/runner/work/go-tfe/go-tfe/run_integration_test.go:597
	            				/home/runner/go/pkg/mod/github.com/!data!dog/dd-trace-go/v2@v2.4.0/internal/civisibility/integrations/gotesting/instrumentation_orchestrion.go:242
	Error:      	Received unexpected error:
	            	transition not allowed
	Test:       	TestRunsApply_RunDependent/when_the_run_exists

ℹ️ Info

🧪 All tests passed

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

@nithishravindra nithishravindra marked this pull request as ready for review November 24, 2025 08:07
@nithishravindra nithishravindra requested a review from a team as a code owner November 24, 2025 08:07
@nithishravindra nithishravindra force-pushed the nithish/stacks-varset-api-2 branch from 593545a to f4006ea Compare November 24, 2025 08:54
@nithishravindra nithishravindra self-assigned this Nov 24, 2025
@nithishravindra nithishravindra changed the title implement UpdateStacks API method for variable sets implement stacks API method for variable sets Nov 25, 2025
@nithishravindra nithishravindra force-pushed the nithish/stacks-varset-api-2 branch 3 times, most recently from 1ef0279 to af5b42f Compare November 26, 2025 05:44
@ctrombley ctrombley force-pushed the nithish/stacks-varset-api-2 branch from af5b42f to 7d5e7b7 Compare November 26, 2025 20:22
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, thanks @nithishravindra!

@nithishravindra nithishravindra merged commit e82d074 into main Dec 1, 2025
25 of 28 checks passed
@nithishravindra nithishravindra deleted the nithish/stacks-varset-api-2 branch December 1, 2025 06:15
@github-actions
Copy link
Copy Markdown

github-actions bot commented Dec 1, 2025

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