Skip to content

Commit b217c4d

Browse files
committed
Add lifecycle create_before_destroy
1 parent 4f8387d commit b217c4d

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# AWS EC2 Instance Terraform module
22

3+
## Grouper fork
4+
Forked from
5+
[terraform-aws-modules/terraform-aws-ec2-instance](https://github.com/Element3Health/terraform-aws-ec2-instance)
6+
7+
Only to add lifecycle hoook of create_before_destroy to the instance resource.
8+
9+
310
Terraform module which creates an EC2 instance on AWS.
411

512
[![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)

main.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,10 @@ resource "aws_instance" "this" {
190190

191191
tags = merge({ "Name" = var.name }, var.instance_tags, var.tags)
192192
volume_tags = var.enable_volume_tags ? merge({ "Name" = var.name }, var.volume_tags) : null
193+
194+
lifecycle {
195+
create_before_destroy = true
196+
}
193197
}
194198

195199
################################################################################

0 commit comments

Comments
 (0)