spacelift-io / terraform-provider-spacelift

Terraform provider to interact with Spacelift
MIT License
74 stars 28 forks source link

missing data_source for spacelift_stack_destructor #544

Open Radkowski opened 4 months ago

Radkowski commented 4 months ago

It is possible to create destructor using resource "spacelift_stack_destructor" "example" { ... }

...but it is not possible to read already created destructor details via data_source.

It could be ideally to have a data source in spacelift provider that allows to get destructorID based on stackID, for example:

data "spacelift_stack_destructor" "example" { stack_id = "1234567890qwertyuiop" }

…that returns all destructor-related data, including destructor_id

jmfontaine commented 4 months ago

Hi @Radkowski,

spacelift_stack_destructor is special because it is not a resource per se but rather a marker that triggers the destruction of a stack's resources. I am not sure how exposing it via a data source makes sense.

What would be the use case for it?

Radkowski commented 4 months ago

Hi @jmfontaine ,

In the nutshell is to dynamically build dependencies based on your example provided here: https://docs.spacelift.io/concepts/stack/stack-dependencies#ordered-stack-creation-and-deletion

I have also described all details here: https://portal.feedback.us.pendo.io/app/#/case/391255

Let me know if you need more explanation

Thank you

jubranNassar commented 2 days ago

Hey @Radkowski - thanks for the context. Would this be used in the depends_on attribute? for example: depends_on = data.spacelift_stack_destructor.example ? if not, I'd be curious to how you'd leverage this.