terraform-aws-modules / terraform-aws-ec2-instance

Terraform module to create AWS EC2 instance(s) resources 🇺🇦
https://registry.terraform.io/modules/terraform-aws-modules/ec2-instance/aws
Apache License 2.0
754 stars 1.87k forks source link

Module does not detect ebs volume size change #257

Closed audiolomb closed 2 years ago

audiolomb commented 2 years ago

Description

If an EC2 instance is already deployed and a modification is done to Terraform to change the EBS volume size, the change is not detected

Versions

Reproduction

Steps to reproduce the behavior:

YES YES

Code Snippet to Reproduce

module "ec2test" {
  source = "terraform-aws-modules/ec2-instance/aws"

  ami                         = "ami-xxxx"
  instance_type               = "r5.12xlarge"
  name                        = "ec2test"
  ebs_optimized               = true
  subnet_id                   = data.terraform_remote_state.vpc.outputs.campus-subnet-a
  vpc_security_group_ids      = [data.terraform_remote_state.vpc.outputs.WBPS-SecurityGroup-WBPS-Management-Base, "sg-xxxxx"]
  associate_public_ip_address = false
  monitoring                  = true
  tags                        = var.ec2test-ect2tags
  volume_tags                 = var.ec2test-ect2tags
  key_name                    = var.aws-key-pair
  private_ip                  = ""
  user_data                   = base64encode(file("user-data-ec2test.sh"))
  iam_instance_profile        = var.iam_instance_profile
  root_block_device = [
    {
      volume_size = 50
      volume_type = "gp3"
      encrypted   = true
      kms_key_id  = data.terraform_remote_state.vpc.outputs.EncryptionKey
    },
  ]
  ebs_block_device = [
    {
      volume_size = 217
      device_name = "/dev/sdb"
      encrypted   = true
      vulume_type = "gp3"
      kms_key_id  = data.terraform_remote_state.vpc.outputs.EncryptionKey
    },
    {
      volume_size = 217
      device_name = "/dev/sdc"
      encrypted   = true
      vulume_type = "gp3"
      kms_key_id  = data.terraform_remote_state.vpc.outputs.EncryptionKey
    },

Expected behavior

Changing the ebsize value from 217 to e.g. 317 should appear as a change in terraform plan output.

Actual behavior

No change detected

Terminal Output Screenshot(s)

No changes. Your infrastructure matches the configuration.

Additional context

audiolomb commented 2 years ago

I just saw that the module does not detect changes for ebs_block_device. Closing

audiolomb commented 2 years ago

Closing

github-actions[bot] commented 1 year ago

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.