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

Modifying the root_block_device type from standard to gp2 should not recreate EC2 instance #8729

Closed
subratkprusty opened this issue May 21, 2019 · 4 comments · Fixed by #12620
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/ec2 Issues and PRs that pertain to the ec2 service.
Milestone

Comments

@subratkprusty
Copy link

subratkprusty commented May 21, 2019

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

AWS is now supporting on the fly EC2 volume modifications. Terraform should not recreate instances while modifying standard volume to gp2 or iops. Terraform should also accomodate this on the fly modifcation feature.

New or Affected Resource(s)

  • aws_instance

Potential Terraform Configuration

-/+ module.app_server.aws_instance.main[0] (new resource required)
      **id:                                        "xxxxxxx" => <computed> (forces new resource)**
      ami:                                       "ami-bb9a6bc2" => "ami-bb9a6bc2"
      arn:                                       "xxxxxx" => <computed>
      associate_public_ip_address:               "true" => "true"
      availability_zone:                         "eu-west-1a" => "eu-west-1a"
      cpu_core_count:                            "2" => <computed>
      cpu_threads_per_core:                      "1" => <computed>
      disable_api_termination:                   "true" => "true"
      ebs_block_device.#:                        "0" => <computed>
      ebs_optimized:                             "false" => "false"
      ephemeral_block_device.#:                  "0" => <computed>
      get_password_data:                         "false" => "false"
      iam_instance_profile:                      "xxxxxxxxx" => "xxxxxxxxxx"
      instance_initiated_shutdown_behavior:      "stop" => "stop"
      instance_state:                            "running" => <computed>
      instance_type:                             "t2.large" => "t2.large"
      ipv6_address_count:                        "" => <computed>
      ipv6_addresses.#:                          "0" => <computed>
      network_interface.#:                       "0" => <computed>
      network_interface_id:                      "xxxxxxxx" => <computed>
      password_data:                             "" => <computed>
      placement_group:                           "" => <computed>
      primary_network_interface_id:              "xxxxxxxxxxxx" => <computed>
      private_dns:                               "xxxxxxxxxxx" => <computed>
      private_ip:                                "xxxxxxxxx" => <computed>
      public_dns:                                "xxxxxxxxxxxx" => <computed>
      public_ip:                                 "xxxxxxxxxx" => <computed>
      root_block_device.#:                       "1" => "1"
      root_block_device.0.delete_on_termination: "true" => "true"
      root_block_device.0.volume_id:             "xxxxxxxx" => <computed>
      root_block_device.0.volume_size:           "30" => "30"
      **root_block_device.0.volume_type:           "standard" => "gp2" (forces new resource)**
  ....
@subratkprusty subratkprusty added the enhancement Requests to existing resources that expand the functionality or scope. label May 21, 2019
@bflad bflad added the service/ec2 Issues and PRs that pertain to the ec2 service. label May 21, 2019
@tmccombs
Copy link
Contributor

Similarly, changing the volume_size and the delete_on_termination settings are possible to do on the fly without recreating the EC2 instance.

@tmccombs
Copy link
Contributor

Well, actually, modifying volumes does have some constraints: it doesn't work for all instance types (specifically older instance types), volume size can only be increased, not decreased, and gp2 volumes can't be changed to spinning-disk volumes. See https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/modify-volume-requirements.html

Ideally, the ForceNew property could be dynamically computed based on the old and new states, but the terraform api doesn't appear to support that currently (but maybe it should?). Maybe it could be done with a CustomizeDiff function, although I understand there are some limitations with that.

If ForceNew must remain static, then I still think it would be better to have ForceNew set to false, since running terraform taint if making a change that requires rebuilding is much simpler than having to manually use the console or cli to apply the change and then refresh in the case a recreate isn't necessary.

@ghost
Copy link

ghost commented Apr 17, 2020

This has been released in version 2.58.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link

ghost commented May 17, 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 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/ec2 Issues and PRs that pertain to the ec2 service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants