Skip to content

Terraform folder deletion fails with projects scheduled for deletion inside #1075

Description

@lupa95

Description

We are using Terraform to manage projects and folders in our Stackit organization.

A pretty frequent use case for us is to delete a project and the folder it was located in. Destroying a project does not delete it right away but schedules it for deletion after some days in Stackit (which is good). However, this causes an issue, that prevents the deletion of it's parent folder.

My best idea would be to implement some logic that upon trying to delete a folder, all projects inside are checked if they are scheduled for deletion. If true, the folder is also scheduled for deletion.

If there is a way to work around it in Terraform, please let me know.

Steps to reproduce

resource "stackit_resourcemanager_folder" "customer" {
  name                = "test-folder"
  owner_email         = var.stackit_owner_email
  parent_container_id = var.stackit_org_id
}

resource "stackit_resourcemanager_project" "project" {
  name                = "test-project"
  owner_email         = var.stackit_owner_email
  parent_container_id = stackit_resourcemanager_folder.customer.id
}
  1. Run terraform apply
  2. Run terraform destroy

Actual behavior

Error occurs:

╷
│ Error: Error deleting folder. Deletion may fail because associated projects remain hidden for up to 7 days after user deletion due to technical requirements.
│ 
│ Calling API: 409 Conflict, status code 409, Body:
│ {"timeStamp":"2025-11-27T09:45:31.636920471Z","path":"/resource-management/v2/folders/test-dir-xxx","status":409,"error":"Conflict","message":"Folder
│ has children. Deletion not permitted for id: [test-dir-xxx]"}
│ 
╵

Expected behavior

Project and folder are properly removed from Terraform state and scheduled for deletion.

Environment

  • OS:
  • Terraform version (see terraform --version): v1.13.4
  • Version of the STACKIT Terraform provider: v0.68.0

Additional information

Feel free to add any additional information here.

Activity

  1. marceljk commented on Nov 27, 2025

    @marceljk
    Contributor

    Hey @lupa95,

    thanks for reporting this issue. This is a limitation by the api. I'll forward your request to the resource manager team, so they can have a look, if it's possible, to add a schedule for deletion.

    Best regards
    Marcel from the STACKIT Developer Tools Team

  2. cschaible commented on Dec 17, 2025

    @cschaible

    Hello @lupa95,

    Thank you for sharing your feedback and taking the time to suggest this feature. We truly appreciate your input and understand how valuable this functionality could be.

    At the moment, this feature is not on our current roadmap, and unfortunately, we do not have a suitable workaround to offer. However, your request has been noted and will be reviewed as we continue to evaluate future enhancements.

    Thank you for helping us improve.

    Best regards
    Christian

  3. alexrothgit commented on Dec 18, 2025

    @alexrothgit

    We have the same issue.
    This is clearly a bug and needs to be fixed asap.
    Please prioritize.
    Thanks
    Alex

  4. alexrothgit commented on Jan 15, 2026

    @alexrothgit

    Any updates here? Can we expect a solution soon?
    Can we do something to raise the prio?
    Thanks
    Alex

  5. mahauber commented on May 7, 2026

    @mahauber

    Any updates?

  6. chearius commented on May 19, 2026

    @chearius

    Hi everyone,

    Thank you for bringing this up and for providing the detailed context.

    The Resource Manager team is currently working on resolving this API limitation to ensure folders can be managed smoothly even when they contain projects scheduled for deletion.

    Our current plan is to have a fix in place around the end of June or early July. Please note that this is our target timeline rather than a binding commitment, but we will keep this thread updated on our progress.

    In the meantime, the temporary workaround is to wait until the projects are completely purged before deleting the parent folder.

    We appreciate your patience while we work through this!

    Best regards,
    Marek

  7. mahauber commented on Jul 24, 2026

    @mahauber

    Thanks for taking care of the issue! Are there any updates or a timeline?

  8. lweberru commented on Aug 28, 2026

    @lweberru

    Any update here? We really need this features for regular build/deploy tests.

  9. alexrothgit commented on Sep 22, 2026

    @alexrothgit

    Hi,
    any updates?
    You mentioned June/July for a fix.
    Or did I miss some other information?

    Thanks
    Alex

  10. lweberru commented on Oct 5, 2026

    @lweberru

    Any updates here? We really wait for folder destroy.

  11. chearius commented on Oct 6, 2026

    @chearius

    Hi @alexrothgit and @lweberru,

    Thank you for your continued patience! The implementation of this has been delayed slightly, as our team has been prioritizing a few other major features over the past few months.

    That being said, this feature is still on our roadmap and remains something we plan to support. We are hoping to get it implemented within the next few months.

    We really appreciate your feedback and your understanding!

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions