Skip to content
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

providers/aws: aws_instance (root) block_device forces new resource on managed infrastructure (no-BC) #978

Closed
pmoust opened this issue Feb 16, 2015 · 3 comments

Comments

@pmoust
Copy link
Contributor

pmoust commented Feb 16, 2015

Relates: #877
Links: #859 (comment)

For instances already managed by terraform (terraform 0.3.7 pre #877) that have block devices defined in .tf (i.e. type set to g2, set size etc), with current upstream master the block devices are being re-computed and force new resource on plan.

example configuration:

resource "aws_instance" "pph_vpn" {
    ami                 = "${var.vpn_ami}"
    instance_type       = "${var.vpn_class}"
    availability_zone   = "${lookup(var.zones, concat("zone", count.index))}"
    subnet_id           = "${element(aws_subnet.pph.*.id, count.index)}"
    associate_public_ip_address = true
    key_name            = "vpn-dec-14" #key to be used to firstly log ing to device with username openvpnas. key is in s3

    user_data           = "${file("../cloud-init/vpn.yml")}"

    tags {
        Name = "vpn0${count.index}"
    }

    block_device {
      device_name = "/dev/sda1"
      volume_type = "standard"
      volume_size = 8
      delete_on_termination = 1
    }
    security_groups     = [ "${aws_security_group.pph_admins.id}",
                            "${aws_security_group.pph_vpn.id}",
                          ]

    count               = 1
}

What is in state currently:

                "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 with Terraform v0.3.7-dev (3339593292d2d16922cbf6270fbbb2bfea7d6440)

-/+ aws_instance.pph_vpn
    ami:                                           "ami-1a942472" => "ami-1a942472"
    associate_public_ip_address:                   "true" => "1"
    availability_zone:                             "us-east-1b" => "us-east-1b"
    block_device.#:                                "1" => "1"
    block_device.2936417914.delete_on_termination: "" => "1" (forces new resource)
    block_device.2936417914.device_name:           "" => "/dev/sda1" (forces new resource)
    block_device.2936417914.encrypted:             "" => "<computed>" (forces new resource)
    block_device.2936417914.snapshot_id:           "" => "<computed>" (forces new resource)
    block_device.2936417914.virtual_name:          "" => "" (forces new resource)
    block_device.2936417914.volume_size:           "" => "8" (forces new resource)
    block_device.2936417914.volume_type:           "" => "standard" (forces new resource)
    instance_type:                                 "t2.micro" => "t2.micro"
    key_name:                                      "vpn-dec-14" => "vpn-dec-14"
    private_dns:                                   "ip-10-30-1-53.ec2.internal" => "<computed>"
    private_ip:                                    "10.30.1.53" => "<computed>"
    public_dns:                                    "<snipped> => "<computed>"
    public_ip:                                     "<snipped>" => "<computed>"
    security_groups.#:                             "2" => "2"
    security_groups.1610004074:                    "sg-d1b443b5" => "sg-d1b443b5"
    security_groups.70589767:                      "sg-d6b443b2" => "sg-d6b443b2"
    subnet_id:                                     "subnet-13b90264" => "subnet-13b90264"
    tags.#:                                        "1" => "1"
    tags.Name:                                     "vpn00" => "vpn00"
    tenancy:                                       "default" => "<computed>"
    user_data:                                     "d012c9fdf3cdde5f3c75743c2329e6879ad5a4cb" => "d012c9fdf3cdde5f3c75743c2329e6879ad5a4cb"

If i comment out the block_device part in the .tf the plan does not mark said instance for change.

@patricklucas
Copy link

This is mostly a dupe of #913; could you comment there?

@pmoust
Copy link
Contributor Author

pmoust commented Feb 16, 2015

@patricklucas thanks, closing in favor of #913

@phinze phinze closed this as completed Feb 17, 2015
@ghost
Copy link

ghost commented May 4, 2020

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.

@ghost ghost locked and limited conversation to collaborators May 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants