Skip to content

[Feature Request] Add Stack Deployment API Specs #150

Description

@isivaselvan

Use-cases

List the stack deployments that belong to a Stack

https://developer.hashicorp.com/terraform/cloud-docs/api-docs/stacks/deployments
https://developer.hashicorp.com/terraform/enterprise/api-docs/stacks/deployments

Attempted Solutions

None, currently unsupported

Proposal

Add support for Stack Deployments as a new resource family in python-tfe.

class StackDeployment(BaseModel):
    """Represents a stack deployment (JSON:API type: stack-deployments)."""
    model_config = ConfigDict(populate_by_name=True, validate_by_name=True)

    id: str
    name: str | None = Field(default=None, alias="name")
  • Add Resource in src/pytfe/resources/stack_deployments.py
class StackDeployments(_Service):
    def list(
        self,
        stack_id: str,
        options: StackDeploymentListOptions | None = None,
    ) -> Iterator[StackDeployment]:
        """List all stack deployments for a given stack.
        GET /api/v2/stacks/{stack_id}/stack-deployments
        """
  • Update Client
  • Add Examples under examples folder
  • Add Unit tests in tests/units

All new code should follow existing project conventions:

  • Pydantic v2 models with populate_by_name=True
  • alias-based JSON:API field mapping
  • _Service base class
  • Iterator-based pagination via _list.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions