-
Notifications
You must be signed in to change notification settings - Fork 9.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EC2 instances with EBS volumes destroyed & recreated on each apply #72
Comments
This comment was originally opened by @tiyberius as hashicorp/terraform#5006 (comment). It was migrated here as part of the provider split. The original comment is below. +1 Having the same issue as @bwhaley on 0.6.11. If it helps, I had the issue on 0.6.9 as well. I was hoping that an upgrade to 0.6.11 would fix it but it has not :( |
This comment was originally opened by @davedash as hashicorp/terraform#5006 (comment). It was migrated here as part of the provider split. The original comment is below. I'm trying to figure this out too in #68. Does your AMI specify an EBS snapshot to mount as a root device? This is my problem with trying to launch and ECS container. |
This comment was originally opened by @bwhaley as hashicorp/terraform#5006 (comment). It was migrated here as part of the provider split. The original comment is below. Yes - but isn't the root volume for all EBS-backed AMIs started from an EBS snapshot? |
This comment was originally opened by @davedash as hashicorp/terraform#5006 (comment). It was migrated here as part of the provider split. The original comment is below. @bwhaley I guess that's the case. So this is only happening on my t2 based instances that happen to be running Amazon Linux. This might just be a coincidence. |
This comment was originally opened by @bwhaley as hashicorp/terraform#5006 (comment). It was migrated here as part of the provider split. The original comment is below. Interesting - in my case it's also Amazon Linux on T2 instance types. |
This comment was originally opened by @octalthorpe as hashicorp/terraform#5006 (comment). It was migrated here as part of the provider split. The original comment is below. ***** Forget that need to use "root_block_device" my mistake
Same behaviour on 0.6.9 thru 0.6.12, possible change on the AWS side? |
This comment was originally opened by @eedwardsdisco as hashicorp/terraform#5006 (comment). It was migrated here as part of the provider split. The original comment is below. +1 I'm hitting this with 0.6.12 Launching an AMI that's a t2.micro with 2 EBS volumes, created using Packer I specify a "root_block_device" and "data_block_device" mapping in the terraform template. It's causing it to mark the data volume as needing to be re-created every time. |
This comment was originally opened by @Sreeramk as hashicorp/terraform#5006 (comment). It was migrated here as part of the provider split. The original comment is below. I am running into a similar issue. In the plan it keeps pointing to the following. |
This comment was originally opened by @serdardalgic as hashicorp/terraform#5006 (comment). It was migrated here as part of the provider split. The original comment is below. I'm also hitting the same issue here:
Although it's already in the terraform.tfstate
Please tell me if you need more info about the issue. |
This comment was originally opened by @serdardalgic as hashicorp/terraform#5006 (comment). It was migrated here as part of the provider split. The original comment is below. I've solved my problem, just to inform you: I was building with AMIs that already have 3 ebs block devices. Then, in terraform, I was provisioning them with cloud-init. That's why in terraform plan output, there are actually 6 different ebs_block_device ids that were creating the trouble. So, on my side, the problem does not exist. Sorry for the confusion. |
This comment was originally opened by @madamedwards as hashicorp/terraform#5006 (comment). It was migrated here as part of the provider split. The original comment is below. I'm having a similar issue. Mine seems to have something to do with the volumes being encrypted. When I run
As noted, the key did not change. |
This comment was originally opened by @dennybaa as hashicorp/terraform#5006 (comment). It was migrated here as part of the provider split. The original comment is below. +1 |
This comment was originally opened by @mr510 as hashicorp/terraform#5006 (comment). It was migrated here as part of the provider split. The original comment is below. +1 In terraform v 0.7 I am getting similar error. When encrypting devices in a aws_db_instance. kms_key_id: "arn:aws:kms:us-west-2::key/key_id" => "Key-ID" (forces new resource) Key id is the same and have not changed. |
This comment was originally opened by @mr510 as hashicorp/terraform#5006 (comment). It was migrated here as part of the provider split. The original comment is below. Hmm so the issues can be resolved by using the arn instead of key_id Forces new resource kms_key_id = "${aws_kms_key.key_name.key_id}" Change it to kms_key_id = "${aws_kms_key.key_name.arn}". No new resource created. |
This comment was originally opened by @iwat as hashicorp/terraform#5006 (comment). It was migrated here as part of the provider split. The original comment is below. Same here, terraform tried to re-create EC2 instance with additional EBS.
Inside terraform.tfstate:
It stops re-creating instance if I change my .tf file from:
to
|
This comment was originally opened by @jurajseffer as hashicorp/terraform#5006 (comment). It was migrated here as part of the provider split. The original comment is below. terraform 0.7.11 here. I use remote statefile (S3). When I run
Statefile has the following for the instance:
config
|
This comment was originally opened by @jstlaurent as hashicorp/terraform#5006 (comment). It was migrated here as part of the provider split. The original comment is below. I'm also getting this with Terraform 0.7.13. My instance definition looks like this:
I get this every time I run plan:
One explanation is that the AMI I'm using (Amazon ECS Optimized, ami-6df8fe7a), defines two block devices. The output from
The line The workaround seems to be to define the EBS devices of the AMI (beyond the first) in my configuration, by adding this:
That fixes the issue, but I have to remember to update it if the AMI change. Less than ideal, unfortunately, since I grabbing the latest. |
I have a similar issue. Whenever I add aws_volume_attachement block, instance gets recreated every single time I run terraform apply.
|
The current workaround for me is to use resource instead of a module for ec2 instance. |
Terraform v0.11.11 Same issue here, EC2 instance t2.small gets re-created each time I add the following EBS block. ebs_block_device = { |
Same issue here, running Terraform v0.14.4. Everytime I ran "terraform apply" ec2 instances is recreated. lifecycle { root_block_device { ebs_block_device { |
Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label. If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you! |
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. |
This issue was originally opened by @bwhaley as hashicorp/terraform#5006. It was migrated here as part of the provider split. The original body of the issue is below.
Running v0.6.11, I noticed that instances with an
ebs_block_device
are recreated every time I runterraform apply
, even if there were no relevant changes. The block looks like this:This seems similar to #913 but that was resolved some time ago. Any ideas?
The text was updated successfully, but these errors were encountered: