-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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 #5006
Comments
+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 :( |
I'm trying to figure this out too in #4786. Does your AMI specify an EBS snapshot to mount as a root device? This is my problem with trying to launch and ECS container. |
Yes - but isn't the root volume for all EBS-backed AMIs started from an EBS snapshot? |
@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. |
Interesting - in my case it's also Amazon Linux on T2 instance types. |
***** 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? |
+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. |
I am running into a similar issue. In the plan it keeps pointing to the following. |
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. |
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. |
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. |
+1 |
+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. |
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. |
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
|
terraform 0.7.11 here. I use remote statefile (S3). When I run
Statefile has the following for the instance:
config
|
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'm trying to add the tags for existing EBS volumes that come with AMI. my terraform script is working. Now i need 2 things. How to avoid "not to remove EBS volume while terminating EC2 Node" and how to add TAGS for existing EBS volumes. provider "aws" { data "template_file" "init" {template = "file("path.module\init.tpl")"# template = "${file("${path.module}\init.tpl")}"}#BEGIN***********************************************************
#***********************************************************End #BEGIN**************************************************************************************************************************************************************
resource "aws_network_interface_sg_attachment" "sg_attachment" { |
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. |
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: