Skip to content

Feature/Stack#128

Merged
isivaselvan merged 4 commits into
next-1.0.0from
feature/stack
May 4, 2026
Merged

Feature/Stack#128
isivaselvan merged 4 commits into
next-1.0.0from
feature/stack

Conversation

@isivaselvan

@isivaselvan isivaselvan commented Apr 16, 2026

Copy link
Copy Markdown
Collaborator

Description

Implemented Stack API Specs
https://developer.hashicorp.com/terraform/cloud-docs/api-docs/stacks

Feature contains:

  • read() --> Show the specific Stack by its ID
  • list() --> List stacks within an organization, with optional filtering by project
  • create() --> Create a new stack within a project.
  • update() --> Update an existing stack
  • delete() --> Delete a stack by ID
  • force_delete() --> ForceDelete deletes a stack that still has deployments.
  • Unit test cases added at tests/units/test_stack.py
  • examples added at examples/stack.py

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.

Unit tests

image

Examples

> python examples/stack.py --operation=list --organization=sandbox01                                  

================================================================================
Listing stacks
================================================================================
Found 2 stacks
-
- id: st-2ipMeTKm
- name: hello-terraform
- description: None
- created_at: 2026-04-16 09:48:12.336000+00:00
- updated_at: 2026-04-16 09:53:09.855000+00:00
- speculation_enabled: None
- project_id: prj-VqLpNrC3vubn842j
- agent_pool_id: None
- vcs_repo:
  identifier=shelve/hello-terraform
  branch=
  github_app_installation_id=None
-
- id: st-Z6bpcB6Jw95eHNtR
- name: test-stack
- description: updated via sdk example
- created_at: 2026-04-16 06:54:49.726000+00:00
- updated_at: 2026-04-16 07:33:51.319000+00:00
- speculation_enabled: None
- project_id: prj-fC61qfoTBVNAAEAu
- agent_pool_id: None


> python examples/stack.py --operation=read --stack-id=st-Z6bpcHNtR

================================================================================
Reading stack
================================================================================
Retrieved stack
- id: st-Z6bpHNtR
- name: test-stack
- description: None
- created_at: 2026-04-16 06:54:49.726000+00:00
- updated_at: 2026-04-16 07:24:15.404000+00:00
- speculation_enabled: None
- project_id: prj-fC61qfoTBVNAAEAu
- agent_pool_id: None

> python examples/stack.py --operation=update --stack-id=st-Z6bp95eHNtR --description='updated via sdk example'

================================================================================
Updating stack
================================================================================
Updated stack
- id: st-Z6bpcHNtR
- name: test-stack
- description: updated via sdk example
- created_at: 2026-04-16 06:54:49.726000+00:00
- updated_at: 2026-04-16 07:33:51.319000+00:00
- speculation_enabled: None
- project_id: prj-fC61qfoTBVNAAEAu
- agent_pool_id: None


> python examples/stack.py --operation=create --name="$name" --project-id=prj-fCAEAu

creating:sdk-stack-130424

================================================================================
Creating stack
================================================================================
Created stack
- id: st-juVuuE2
- name: sdk-stack-130424
- description: None
- created_at: 2026-04-16 07:34:25.756000+00:00
- updated_at: 2026-04-16 07:34:25.756000+00:00
- speculation_enabled: None
- project_id: prj-fC61qfoTBVNAAEAu
- agent_pool_id: None


>python examples/stack.py --operation=delete --stack-id=st-juVuuyV7SqKVtuE2

================================================================================
Deleting stack
================================================================================
Deleted stack: st-juVuuyV7SqKVtuE2

> python examples/stack.py --operation=create --name="$name" --project-id=prj-fC6AEAu
creating:sdk-stack-force-130528

================================================================================
Creating stack
================================================================================
Created stack
- id: st-dS445xSn6
- name: sdk-stack-force-130528
- description: None
- created_at: 2026-04-16 07:35:29.984000+00:00
- updated_at: 2026-04-16 07:35:29.984000+00:00
- speculation_enabled: None
- project_id: prj-fC61qfoTBVNAAEAu
- agent_pool_id: None

> python examples/stack.py --operation=force-delete --stack-id=st-dS4xSn6

================================================================================
Force deleting stack
================================================================================
Force deleted stack: st-dS44xSn6

Rollback Plan

Changes to Security Controls

PCI review checklist

  • I have documented a clear reason for, and description of, the change I am making.

  • If applicable, I've documented a plan to revert these changes if they require more than reverting the pull request.

  • If applicable, I've documented the impact of any changes to security controls.

    Examples of changes to security controls include using new access control methods, adding or removing logging pipelines, etc.

If you have any questions, please contact your direct supervisor, GRC (#team-grc), or the PCI working group (#proj-pci-reboot). You can also find more information at PCI Compliance.

@isivaselvan isivaselvan requested a review from a team as a code owner April 16, 2026 11:14
Comment thread examples/stack.py Dismissed
@isivaselvan isivaselvan merged commit 926bc7a into next-1.0.0 May 4, 2026
11 checks passed
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