terraform-aws-modules / terraform-aws-ec2-instance

Terraform module to create AWS EC2 instance(s) resources 🇺🇦
https://registry.terraform.io/modules/terraform-aws-modules/ec2-instance/aws
Apache License 2.0
754 stars 1.87k forks source link

TAG Lifecycle #311

Closed djacquensf9 closed 1 year ago

djacquensf9 commented 1 year ago

Hi all, :)

I started using the terraform-aws-modules a few weeks, everything is working fine except I have a problem with TAG lifecycle. Many tags, specially on Root EBS have issue with the lifecycle, everytime I run a terraform apply, they are in turn created or deleted. Some Root EBS Name are modified, once with the EBS Name, the following time with the EC2 Name ...

I thought I should add a lifecycle Meta-Argument in my code but while I manage to do it in ressource, I can not use it with modules. Is it the right way to solve this issue?

Any feedback are welcomed! ;)

Thanks in advance,

David

djacquensf9 commented 1 year ago

Hi,

Do you understand my issue? I am really stuck as the TAGS allows us to do AWS backups and I am forced to create the tags manually after every "terraform apply".

Thanks,

David

djacquensf9 commented 1 year ago

OK, i discovered this conversation. https://stackoverflow.com/questions/67778177/terraform-can-i-pass-ignore-changes-to-the-module

I am really troubled now.
Modules (especially these modules) are great but this is a big drawback if lifecycle can't be implemented easily...

Thanks

antonbabenko commented 1 year ago

Make sure to specify tags on root_block_device or volume_tags to have them adequately propagated to the resources.

There is nothing we can do in the modules to allow parametrization of lifecycle meta-argument because, as you discovered, it is not supported by Terraform.

github-actions[bot] commented 1 year ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.