hashicorp / terraform-cdk

Define infrastructure resources using programming constructs and provision them using HashiCorp Terraform
https://www.terraform.io/cdktf
Mozilla Public License 2.0
4.85k stars 450 forks source link

Before destroy notification: clean up #3596

Open cyber-francis opened 5 months ago

cyber-francis commented 5 months ago

Description

Let me make up a scenario in GCP.

Say I create a subnet using cdktf python. The properties of this subnet is read from a config file. If I remove the config file, this subnet will be destroyed. This is fine.

But, I want to identify/know if this resource will be destroyed, so I can do some cleanup before the actual destroy. Please, is if this possible?

In simple terms: subnet = SubnetClass(on_destroy=cleanup)

References

No response

Help Wanted

Community Note