Skip to content

feat: Add force_delete option to coderd_organization resource #300

@uzair-coder07

Description

@uzair-coder07

Description

When a coderd_organization resource is destroyed, the deletion fails if the organization contains any resources (workspaces, templates, members, groups, or provisioner keys). This requires manual cleanup before Terraform can successfully remove the organization, which breaks the declarative infrastructure-as-code workflow.

Current Behavior

resource "coderd_organization" "example" {
  name = "example-org"
}

Expected Behavior

Add a force_delete attribute to the coderd_organization resource that cascades deletion to all organization resources when the organization is destroyed.

resource "coderd_organization" "example" {
  name         = "example-org"
  force_delete = true  # Cascade delete all resources on destroy
}

Dependencies

This feature depends on coder/coder#21893, which adds force deletion support to the Coder API.

Usecases

  • Ephemeral environments: Spin up and tear down entire organizations for testing/demos
  • Automated cleanup: CI/CD pipelines that create temporary organizations
  • Full infrastructure management: Manage organizations entirely through Terraform without manual intervention

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions