terraform-aws-ec2-instance icon indicating copy to clipboard operation
terraform-aws-ec2-instance copied to clipboard

Cannot change the size of attached EBS volume

Open dstkdevhrp opened this issue 3 years ago β€’ 1 comments

  • [ Y ] βœ‹ I have searched the open/closed issues and my issue is not listed.

⚠️ Note

Before you submit an issue, please perform the following first:

  1. Remove the local .terraform directory (! ONLY if state is stored remotely, which hopefully you are following that best practice!): rm -rf .terraform/
  2. Re-initialize the project root to pull down modules: terraform init
  3. Re-attempt your terraform plan or apply and check if the issue still persists

Versions

  • Module version [Required]: 4.1

Terraform v1.2.1 on darwin_amd64

  • provider registry.terraform.io/hashicorp/aws v4.22.0

Reproduction Code [Required]

module "instances_ha_cluster" {
  source  = "terraform-aws-modules/ec2-instance/aws"
  version = "~> 4.0"

  name                        = instance_test
  ami                         = ami-073770dc3242b2a06 // AWS ap-northeast-1 tokyo
  instance_type               = m6i.large
  subnet_id                   = default_subnet // should be one in your test env
  vpc_security_group_ids      = default_security_group // should be one in your test env
  associate_public_ip_address = false
  // key_name                    = random_pet.this.id // can be ignored, not related to the bug
  source_dest_check           = false  # for Calico network
  root_block_device = [
    {
      encrypted   = false
      volume_type = "gp3"
      volume_size = 16
    },
  ]
  ebs_block_device = [
    {
      device_name = "/dev/sdf"
      volume_type = "gp3"
      volume_size = 96 // Bug related to this param, after created, no matter which number it's changed to, Terraform always say 'no changes needed ...'
      encrypted   = false
    }
  ]
  monitoring                  = true
  // iam_instance_profile        = data.aws_iam_instance_profile.aiip_ecr_read.name // ignored
  // tags                        = local.tags_cluster // ignored
}

Steps to reproduce the behavior:

No Yes
  1. Run the code copied above, we can got an ec2 instance created in AWS.
  2. Change the value of 'volume_size' param in node 'ebs_block_device', Terraform didn't notice it and didn't proceed the change.

Expected behavior

I hope Terraform can update the volume size of the extra ebs volume of the ec2 instance.

Actual behavior

No matter which number it's changed to, Terraform always say 'no changes needed ...'

Terminal Output Screenshot(s)

Screen Shot 2022-07-19 at 9 05 28 AM

Thanks for your product and the support!

dstkdevhrp avatar Jul 19 '22 16:07 dstkdevhrp

Hi dstkdevhrp, You can use below configuration to increase root disk size,It is working for me. data "aws_kms_key" "ebs" { key_id = "alias/aws/ebs" } root_block_device = [ { delete_on_termination = true encrypted = true kms_key_id = data.aws_kms_key.ebs.arn volume_size = 200 volume_type = "gp2" tags = { Created_using_terraform = true } } ]

ravindrasinghh avatar Jul 22 '22 14:07 ravindrasinghh

This issue has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this issue will be closed in 10 days

github-actions[bot] avatar Aug 22 '22 00:08 github-actions[bot]

This issue was automatically closed because of stale in 10 days

github-actions[bot] avatar Sep 02 '22 00:09 github-actions[bot]

I have the same issue - changes in the ebs_block_device object produces no changes

Udbv avatar Sep 29 '22 12:09 Udbv

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.

github-actions[bot] avatar Nov 08 '22 02:11 github-actions[bot]