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

Setting iops for gp2 block device in launch configuration causes recreation of instances #4002

Closed
ghost opened this issue Mar 31, 2018 · 2 comments
Labels
bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service. stale Old or inactive issues managed by automation, if no further action taken these will get closed.

Comments

@ghost
Copy link

ghost commented Mar 31, 2018

This issue was originally opened by @rsheldon as hashicorp/terraform#17745. It was migrated here as a result of the provider split. The original body of the issue is below.


Terraform Version

Terraform v0.11.3

Terraform Configuration Files

variable "root_volume_size" {
  description = "Size (in GB) that you want the root volume to be"
  default = 20
}

variable "data_volume_iops" {
  description = "IOPS that you want the data volume to be (used for RabbitMQ data). Only effective when data_volume_type=io1 "
  default = 1500
}

variable "data_volume_size" {
  description = "Size (in GB) that you want the data volume to be (used for RabbitMQ data)"
  default = 50
}

variable "data_volume_type" {
  description = "EBS volume type that you want the data volume to be (used for RabbitMQ data). eg. gp2 (default) or io1 (higher throughput)"
  default = "gp2"
}

resource "aws_launch_configuration" "rabbit_launch_config" {
  name_prefix = "${var.name}-lc-"
  image_id = "${var.ami}"
  instance_type = "${var.instance_type}"
  iam_instance_profile = "${data.aws_iam_instance_profile.rmq_instance_profile.name}"
  key_name = "${var.aws_keypair_name}"
  security_groups = ["${var.security_group_ids}"]
  user_data = "${data.template_file.rabbitmq_cloud_init.rendered}"

  root_block_device {
    volume_type = "gp2"
    volume_size = "${var.root_volume_size}"
  }

  ebs_block_device {
    device_name = "/dev/sdf"
    volume_type = "${var.data_volume_type}"
    volume_size = "${var.data_volume_size}"
    iops        = "${var.data_volume_iops}"
  }

  lifecycle {
    create_before_destroy = true
  }
}

Expected Behavior

When I run terraform apply after making no new changes, it says that I don't have any changes.

Actual Behavior

If I run plan immediately after I have run apply it should detect no differences. However, it says it needs to recreate the block device again. I have tracked this down to me setting (well defaulting) IOPS on the block device, when using a "gp2" device type.

I can work around this by changing my code to be

  ebs_block_device {
    device_name = "/dev/sdf"
    volume_type = "${var.data_volume_type}"
    volume_size = "${var.data_volume_size}"
    iops        = "${var.data_volume_type == "io1" ? var.data_volume_iops : 0}"
  }

I was defaulting the IOPS to 1500. If IOPS is not applicable for the "gp2" data type, then it should be ignored (whether it's set or not).

Steps to Reproduce

terraform init
terraform apply
terraform plan

Additional Context

References

I think these may be related:
#3239
#72

@bflad bflad added bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service. labels Apr 2, 2018
@github-actions
Copy link

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!

@github-actions github-actions bot added the stale Old or inactive issues managed by automation, if no further action taken these will get closed. label Mar 27, 2020
@ghost
Copy link
Author

ghost commented May 27, 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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators May 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service. stale Old or inactive issues managed by automation, if no further action taken these will get closed.
Projects
None yet
Development

No branches or pull requests

1 participant