From b217c4d131fe38fa78371a18724f37a5a73f50fc Mon Sep 17 00:00:00 2001 From: Roger Spencer Date: Thu, 8 Aug 2024 07:51:07 -0400 Subject: [PATCH] Add lifecycle create_before_destroy --- README.md | 7 +++++++ main.tf | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/README.md b/README.md index 8f22cb7d..c8a2e780 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,12 @@ # AWS EC2 Instance Terraform module +## Grouper fork +Forked from +[terraform-aws-modules/terraform-aws-ec2-instance](https://github.com/Element3Health/terraform-aws-ec2-instance) + +Only to add lifecycle hoook of create_before_destroy to the instance resource. + + Terraform module which creates an EC2 instance on AWS. [![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md) diff --git a/main.tf b/main.tf index 2f291307..fec05185 100644 --- a/main.tf +++ b/main.tf @@ -190,6 +190,10 @@ resource "aws_instance" "this" { tags = merge({ "Name" = var.name }, var.instance_tags, var.tags) volume_tags = var.enable_volume_tags ? merge({ "Name" = var.name }, var.volume_tags) : null + + lifecycle { + create_before_destroy = true + } } ################################################################################