Closed mhowell-ims closed 1 year ago
This issue has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this issue will be closed in 10 days
This is still an issue.
This issue has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this issue will be closed in 10 days
This issue was automatically closed because of stale in 10 days
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.
Description
According to the AWS docs, you can configure an ASG with a network interface ID for device zero. In this case, the ASG can only create a single EC2 instance, and any instance created by the ASG will always be attached to the given ENI. I.e. if the instance gets terminated, the replacement instance will still attach to the same ENI.
This works fine with this module, except for one thing. If for any reason the aws_autoscaling_group created by this module needs to be replaced, the following error occurs:
I'm fairly certain this is caused by the fact that the aws_autoscaling_group resource created by the module has create_before_destroy enabled. With that setting in place, when the ASG gets replaced, the new ASG is created before the old one gets deleted. When that happens, the new ASG tries to create an instance, which tries to attach to the ENI, which is still attached to the old instance from the original ASG, thus producing the error above.
So the fix for this might involve adding an option to control the create_before_destroy setting on the aws_autoscaling_group resource. Or use the presence of a network_interface_id in the network_interfaces to determine how to set the create_before_destroy.
Versions
Module version [Required]: 6.9.0
Terraform version: 1.3.7
Provider version(s):
Reproduction Code [Required]
Steps to reproduce the behavior:
Are you using workspaces? NO Have you cleared the local cache (see Notice section above)? YES
Expected behavior
Replacing the ASG should not result in the error above. Setting create_before_destroy to false may address the issue.