terraform-aws-ec2-instance icon indicating copy to clipboard operation
terraform-aws-ec2-instance copied to clipboard

Allow creation of no-delete EC2 instances

Open jeffb4 opened this issue 10 months ago β€’ 3 comments

Is your request related to a new offering from AWS?

This is not related to a new AWS offering

Is your request related to a problem? Please describe.

I'd like to use this very handy module for some EC2 instances that just frankly should never get deleted automatically. Examples for me are database servers - it's possible I'll need to tear them down and relaunch with automation, but the tearing down bit is likely to involve a human and a console.

Describe the solution you'd like.

The ignore_ami solution works very well, so maybe a protected_instance var for the module that creates an instance with lifecycle rules prevent_destroy and either ignore_changes all or an enumerated list of ec2 changes that would force a replacement.

Describe alternatives you've considered.

In the alternate, I could beg on my knees for Hashicorp to implement a way to add lifecycle rules programmatically to resources created in modules. Or, they could implement a way for module writers to allow lifecycle stuff to be parameterized and passed in.

Additional context

jeffb4 avatar Apr 19 '24 18:04 jeffb4