Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Pre-build AMIs cause runners to have additional unused ebs when nothing is provided to block_device #1769

@Hankier

Description

@Hankier

So we are using ubuntu-focal
for our runners as we have ebs created from this part of code:

    device_name           = "/dev/sda1"
    volume_size           = "${var.root_volume_size_gb}"
    volume_type           = "gp3"
    delete_on_termination = "${var.ebs_delete_on_termination}"
  }

But this part cause images to have other ebs with default value of 30GB.

    for_each = [var.block_device_mappings]
    content {
      device_name = lookup(block_device_mappings.value, "device_name", "/dev/xvda")

      ebs {
        delete_on_termination = lookup(block_device_mappings.value, "delete_on_termination", true)
        volume_type           = lookup(block_device_mappings.value, "volume_type", "gp3")
        volume_size           = lookup(block_device_mappings.value, "volume_size", var.volume_size)
        encrypted             = lookup(block_device_mappings.value, "encrypted", true)
        iops                  = lookup(block_device_mappings.value, "iops", null)
      }
    }
}  

Screenshot 2022-02-21 at 16 00 13

Defaults are taken from:

  description = "The EC2 instance block device configuration. Takes the following keys: `device_name`, `delete_on_termination`, `volume_type`, `volume_size`, `encrypted`, `iops`"
  type        = map(string)
  default     = {}
}

variable "volume_size" {
  description = "Size of runner volume"
  type        = number
  default     = 30
}

What should we do about that? Should module accept null and not configure or ignore a empty {}?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions