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

ebs_block_volume causing a refresh #2126

Closed
mzupan opened this issue May 28, 2015 · 3 comments
Closed

ebs_block_volume causing a refresh #2126

mzupan opened this issue May 28, 2015 · 3 comments

Comments

@mzupan
Copy link
Contributor

mzupan commented May 28, 2015

I have the following

resource "aws_instance" "ci" {
  ami = "${lookup(var.ami, var.env)}"
  instance_type = "${lookup(var.instance-type-ci, var.env)}"
  key_name = "${lookup(var.key, var.env)}"
  vpc_security_group_ids = [
      "${aws_security_group.internal-default.id}",
      "${aws_security_group.internal-web.id}",

  ]
  subnet_id = "${aws_subnet.mgmt.2.id}"

  iam_instance_profile = "${aws_iam_instance_profile.ci.id}"

  tags {
      CostCenter = "web"
      Name = "WEB ci.${var.env}"
      Roles = "ci"
  }
  user_data = "ci.${var.env}.urthecast.com"
  private_ip = "${lookup(var.vpc-subnet, var.env)}.2.20"


  ebs_block_device = {
    device_name = "/dev/xvdj"
    volume_size = "200"
    delete_on_termination = false
    volume_type = "gp2"
  }
}

When I do a plan I get

-/+ aws_instance.ci
    ami:                                               "ami-c4a1b1ac" => "ami-c4a1b1ac"
    availability_zone:                                 "us-east-1d" => "<computed>"
    ebs_block_device.#:                                "2" => "1"
    ebs_block_device.3871590789.delete_on_termination: "false" => "0" (forces new resource)
    ebs_block_device.3871590789.device_name:           "/dev/xvdj" => "/dev/xvdj" (forces new resource)
    ebs_block_device.3871590789.encrypted:             "false" => "<computed>"
    ebs_block_device.3871590789.iops:                  "600" => "<computed>"
    ebs_block_device.3871590789.snapshot_id:           "" => "<computed>"
    ebs_block_device.3871590789.volume_size:           "200" => "200" (forces new resource)
    ebs_block_device.3871590789.volume_type:           "gp2" => "gp2" (forces new resource)

its an EBS backed instance.. here's my state

                "aws_instance.ci": {
                    "type": "aws_instance",
                    "depends_on": [
                        "aws_iam_instance_profile.ci",
                        "aws_security_group.internal-default",
                        "aws_security_group.internal-web",
                        "aws_subnet.mgmt"
                    ],
                    "primary": {
                        "id": "i-479604b8",
                        "attributes": {
                            "ami": "ami-c4a1b1ac",
                            "availability_zone": "us-east-1d",
                            "ebs_block_device.#": "2",
                            "ebs_block_device.3871590789.delete_on_termination": "false",
                            "ebs_block_device.3871590789.device_name": "/dev/xvdj",
                            "ebs_block_device.3871590789.encrypted": "false",
                            "ebs_block_device.3871590789.iops": "600",
                            "ebs_block_device.3871590789.snapshot_id": "",
                            "ebs_block_device.3871590789.volume_size": "200",
                            "ebs_block_device.3871590789.volume_type": "gp2",
                            "ebs_block_device.630982455.delete_on_termination": "true",
                            "ebs_block_device.630982455.device_name": "/dev/sda",
                            "ebs_block_device.630982455.encrypted": "false",
                            "ebs_block_device.630982455.iops": "60",
                            "ebs_block_device.630982455.snapshot_id": "snap-314ff043",
                            "ebs_block_device.630982455.volume_size": "20",
                            "ebs_block_device.630982455.volume_type": "gp2",
Terraform v0.5.2
@phinze
Copy link
Contributor

phinze commented May 28, 2015

Hi @mzupan,

Just tested with a new instance to check if there was a perpetual refresh issue, which I'm not seeing over here. So I'm wondering if you're asking something different - did you add the ebs_block_device to the existing instance?

Modifying any ebs_block_device on an instance currently requires resource replacement [1]. If you'd like to add an EBS volume to an existing instance you'll need to use the ebs_volume resource along with the forthcoming volume_attachment #2050

Let me know if I'm missing something here - happy to dig in further.

[1] See Block Devices section here: https://terraform.io/docs/providers/aws/r/instance.html

@mzupan
Copy link
Contributor Author

mzupan commented May 28, 2015

i'm gonna close it since i'm using that PR now and its working as expected.

@mzupan mzupan closed this as completed May 28, 2015
@ghost
Copy link

ghost commented May 2, 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 2, 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

2 participants