cloudposse / cloudposse/terraform-aws-ec2-instance

`associate_public_ip_address` triggers recreation if instance is stopped

Open
#121 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
HCL
Stars
169
Forks
216
PR merge metrics
No merged PRs in 30d

Description

## Describe the Bug
Creating an instance using this module with the following flags:
```
associate_public_ip_address = true
assign_eip_address = false
```
causes the instance to be recreated when it is `stopped` because the "public address" (not EIP) is released when the server is shutdown.

To prevent this from happening we could add a lifecycle configuration which ignores this particular key. Unfortunately this cannot be done on a `module` object within Terraform so it must be done from inside the module itself.

## Expected Behavior
No instance re-creation.

## Steps to Reproduce
Steps to reproduce the behavior:
1. Create an instance with the above flags
2. Stop the instance
3. Re-run `plan` and see that it will be recreated

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.