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

EBS Volume usage causes resource to be recreated #605

Closed
spyrospph opened this Issue Nov 26, 2014 · 3 comments

Comments

Projects
None yet
4 participants
@spyrospph

spyrospph commented Nov 26, 2014

Hi,

After using the ebs block in an aws resource type, the instance constantly gets recreated.

terraform plan output is:

-/+ aws_instance.web1
ami: "ami-9aaa1cf2" => "ami-9aaa1cf2"
associate_public_ip_address: "true" => "1"
availability_zone: "us-east-1b" => "us-east-1b"
block_device.#: "1" => "1"
block_device.0.delete_on_termination: "true" => "1" (forces new resource)
block_device.0.device_name: "/dev/sda1" => "/dev/sda1" (forces new resource)
block_device.0.encrypted: "false" => ""
block_device.0.snapshot_id: "" => ""
block_device.0.volume_size: "256" => "256" (forces new resource)
block_device.0.volume_type: "standard" => "standard" (forces new resource)
instance_type: "t2.micro" => "t2.micro"
key_name: "" => ""
private_dns: "ip-10-30-1-11.ec2.internal" => ""
private_ip: "10.30.1.11" => ""
public_dns: "ec2-54-174-12-251.compute-1.amazonaws.com" => ""
public_ip: "54.174.12.251" => ""
security_groups.#: "5" => "5"
security_groups.0: "sg-3db55459" => "sg-3db55459"
security_groups.1: "sg-39b5545d" => "sg-39b5545d"
security_groups.2: "sg-31b55455" => "sg-31b55455"
security_groups.3: "sg-06b55462" => "sg-06b55462"
security_groups.4: "sg-37b55453" => "sg-37b55453"
subnet_id: "subnet-d654e7a1" => "subnet-d654e7a1"
tags.Name: "seagrave00" => "seagrave00"
user_data: "6a7f3e5e17109ede64c70d1158d8bac27e5e416d" => "6a7f3e5e17109ede64c70d1158d8bac27e5e416d"

My terraform code is:

resource "aws_instance" "web1" {
ami = "${var.web_ami}"
instance_type = "${var.web_class}"
availability_zone = "${lookup(var.zones, concat("zone", count.index))}"
subnet_id = "${element(aws_subnet.web.*.id, count.index)}"
associate_public_ip_address = true

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

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

block_device {
  device_name = "/dev/sda1"
  volume_type = "standard"
  volume_size = 256
}

security_groups     = [ "${aws_security_group.admin.id}" ]

count               = "${var.web_count}"

}

Is this an issue someone else is facing as well?

-S.

@spyrospph

This comment has been minimized.

spyrospph commented Nov 26, 2014

This is caused because of not explicitly specifying on the block_device block the delete_on_termination flag or specifying it with a boolean (true false)

So to avoid instance recreation enter:

delete_on_termination = 1

@pmoust

This comment has been minimized.

Contributor

pmoust commented Nov 26, 2014

Seems to be a strconv to bool issue?

@phinze

This comment has been minimized.

Member

phinze commented Jan 28, 2015

Looks like #824 was a dup of this issue that we didn't catch, and all the fun bugfix activity occurred over there, so I'll close this one as a dup while acknowledging that you were definitely first to report. ;)

Feel free to reopen if the fix applied in #824 doesn't solve your issue! ⛵️

@phinze phinze closed this Jan 28, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment