-
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
Upgrade from 0.3.5->0.3.6 forces recreation of new aws_instances with block_storage #859
Comments
I should note that these are volumes with an EBS root volume as well, which could explain:
|
Also I tried the trick in #824 to add:
and that did not help |
Hm, this is going to be hard to debug without a more complete state file. Can you show the complete state of the instance minus perhaps the DNS? |
Sorry about that @mitchellh. I added more back context of the |
Hm, based on the state it looks like it might be doing the right thing? Your config has one block device but your state has two. Can you explain that in more detail? |
The state is listing the root volume (which is EBS) in addition to the attached non-root volume I defined in the |
Got it that's the bug then. We should probably ignore the root volume... |
We hit this too, even starting clean from 0.3.6. The symptom was that Terraform wanted to recreate any aws_instance resources with block device mappings on every apply. I'm downgrading to 0.3.5 in the mean time. |
I need to look at the implementation of the block_device configuration but I'd be willing to bet that the ephemerals would also cause this bug if they are exposed as available devices. They should likely be ignored as well. That would make this semi related to #858. |
fixes #859 EC2 root block devices are attached automatically at launch [1] and show up in DescribeInstances responses from then on. By skipping these when recording state, Terraform can avoid thinking there should be block device changes when there are none. Note this requires that mitchellh/goamz#214 land first so the proper field is exposed. [1] http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/RootDeviceStorage.html
Alrighty - this landed yesterday. In 0.3.7 terraform will happily ignore the root volume and get less confused about block devices it should consider changing! 👍 |
@phinze ouch, we have issues with c88c4a3#diff-5ae59bd3cb446e5b3d5b8521f0b43ac4 since we have defined EBS root block devices in some
"aws_instance.pph_vpn": {
"type": "aws_instance",
"depends_on": [
"aws_subnet.pph",
"aws_security_group.pph_admins",
"aws_security_group.pph_vpn"
],
"primary": {
"id": "i-3cf1f8d6",
"attributes": {
"ami": "ami-1a942472",
"associate_public_ip_address": "true",
"availability_zone": "us-east-1b",
"block_device.#": "1",
"block_device.2849382189.delete_on_termination": "false",
"block_device.2849382189.device_name": "",
"block_device.2849382189.encrypted": "false",
"block_device.2849382189.snapshot_id": "snap-5203c08f",
"block_device.2849382189.virtual_name": "",
"block_device.2849382189.volume_size": "160",
"block_device.2849382189.volume_type": "standard",
"id": "i-3cf1f8d6",
"instance_type": "t2.micro",
"key_name": "vpn-dec-14",
"private_dns": "ip-10-30-1-53.ec2.internal",
"private_ip": "10.30.1.53",
"public_dns": "<snipped>",
"public_ip": "<snipped>",
"security_groups.#": "2",
"security_groups.1610004074": "sg-d1b443b5",
"security_groups.70589767": "sg-d6b443b2",
"subnet_id": "subnet-13b90264",
"tags.#": "1",
"tags.Name": "vpn00",
"tenancy": "default",
"user_data": "d012c9fdf3cdde5f3c75743c2329e6879ad5a4cb"
}
}
}, plan
|
Shall I open a separate issue for this? |
AWS provides a single `BlockDeviceMapping` to manage three different kinds of block devices: (a) The root volume (b) Ephemeral storage (c) Additional EBS volumes Each of these types has slightly different semantics [1]. (a) The root volume is defined by the AMI; it can only be customized with `volume_size`, `volume_type`, and `delete_on_termination`. (b) Ephemeral storage is made available based on instance type [2]. It's attached automatically if _no_ block device mappings are specified, and must otherwise be defined with block device mapping entries that contain only DeviceName set to a device like "/dev/sdX" and VirtualName set to "ephemeralN". (c) Additional EBS volumes are controlled by mappings that omit `virtual_name` and can specify `volume_size`, `volume_type`, `delete_on_termination`, `snapshot_id`, and `encryption`. After deciding to ignore root block devices to fix #859, we had users with configurations that were attempting to manage the root block device chime in on #913. Terraform does not have the primitives to be able to properly handle a single collection of resources that is partially managed and partially computed, so our strategy here is to break out logical sub-resources for Terraform and hide the BlockDeviceMapping inside the provider implementation. Now (a) is supported by the `root_block_device` sub-resource, and (b) and (c) are still both merged together under `block_device`, though I have yet to see ephemeral block devices working properly. Looking into possibly separating out `ephemeral_block_device` and `ebs_block_device` sub-resources as well, which seem like the logical next step. We'll wait until the next big release for this, though, since it will break backcompat. [1] http://bit.ly/ec2bdmap [2] http://bit.ly/instancestorebytype Fixes #913 Refs #858
fixes hashicorp#859 EC2 root block devices are attached automatically at launch [1] and show up in DescribeInstances responses from then on. By skipping these when recording state, Terraform can avoid thinking there should be block device changes when there are none. Note this requires that mitchellh/goamz#214 land first so the proper field is exposed. [1] http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/RootDeviceStorage.html
AWS provides a single `BlockDeviceMapping` to manage three different kinds of block devices: (a) The root volume (b) Ephemeral storage (c) Additional EBS volumes Each of these types has slightly different semantics [1]. (a) The root volume is defined by the AMI; it can only be customized with `volume_size`, `volume_type`, and `delete_on_termination`. (b) Ephemeral storage is made available based on instance type [2]. It's attached automatically if _no_ block device mappings are specified, and must otherwise be defined with block device mapping entries that contain only DeviceName set to a device like "/dev/sdX" and VirtualName set to "ephemeralN". (c) Additional EBS volumes are controlled by mappings that omit `virtual_name` and can specify `volume_size`, `volume_type`, `delete_on_termination`, `snapshot_id`, and `encryption`. After deciding to ignore root block devices to fix hashicorp#859, we had users with configurations that were attempting to manage the root block device chime in on hashicorp#913. Terraform does not have the primitives to be able to properly handle a single collection of resources that is partially managed and partially computed, so our strategy here is to break out logical sub-resources for Terraform and hide the BlockDeviceMapping inside the provider implementation. Now (a) is supported by the `root_block_device` sub-resource, and (b) and (c) are still both merged together under `block_device`, though I have yet to see ephemeral block devices working properly. Looking into possibly separating out `ephemeral_block_device` and `ebs_block_device` sub-resources as well, which seem like the logical next step. We'll wait until the next big release for this, though, since it will break backcompat. [1] http://bit.ly/ec2bdmap [2] http://bit.ly/instancestorebytype Fixes hashicorp#913 Refs hashicorp#858
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. |
Almost all my EC2 instances need to be recreated when I run
plan
:plan
output:tfstate:
It's a little hard to see why a new resource is being forced here. Usually I can adjust something in either the tfstate, or alter the block storage stanza to get this to work.
The text was updated successfully, but these errors were encountered: