Skip to main content

SKY-D406 · Deployment and infrastructure

Terraform creates an unencrypted EBS volume

High

An EBS volume is a disk attached to an EC2 server. SKY-D406 reports a Terraform aws_ebs_volume with encrypted = false.

Languages
Terraform
Quality gate
counted toward the gate limits (full and diff scans). Reported under security (danger). It counts toward max_high and max_security; the rule never reports CRITICAL.
Finding type
review
Catalog name
Terraform AWS EBS volume encryption disabled
Wrong result? Report itA false positive, a missed case or a confusing message: it goes privately to the founder.

Why it matters

Snapshots of an unencrypted volume are unencrypted too, and they are easy to copy or share by mistake. Encryption also cannot be switched on for an existing volume; it has to be copied.

What Skylos flags

main.tf · TerraformReported on line 1
resource "aws_ebs_volume" "uploads" {  availability_zone = "eu-west-1a"  size              = 200  type              = "gp3"  encrypted         = false}

What Skylos leaves alone

main.tf · Terraform
resource "aws_ebs_volume" "uploads" {  availability_zone = "eu-west-1a"  size              = 200  type              = "gp3"  encrypted         = true  kms_key_id        = aws_kms_key.ebs.arn}

Why Skylos leaves it alone

Encryption is requested explicitly, with a customer-managed key.

How Skylos decides

  1. Runs with --danger (or -a). Reads .tf and .tf.json files, skipping .terraform, .git, node_modules, vendor, build, dist and virtual-environment folders, and parses them as HCL without running Terraform or contacting AWS.
  2. Resolves only literal values and local values of the same module. Input variables, data sources, attributes of other resources and module outputs stay unknown, and an unknown value never produces a finding.
  3. Skips a resource with count = 0 or an empty for_each, and needs the official AWS provider (hashicorp/aws, which an aws_ resource uses unless another provider is configured).
  4. Checks aws_ebs_volume resources.
  5. Reports when encrypted is the literal false. A volume made from a snapshot (snapshot_id) is not judged, because it inherits the snapshot's encryption, and neither is a kms_key_id without encrypted = true.
  6. Reports HIGH on the resource line. An account that has EBS encryption by default turned on may encrypt the volume anyway.

How to fix it

Set encrypted = true, ideally with your own KMS key, and turn on EBS encryption by default for the account (aws_ebs_encryption_by_default).

main.tf · Terraform · the fix, against the flagged file
resource "aws_ebs_volume" "uploads" {  availability_zone = "eu-west-1a"  size              = 200  type              = "gp3"Removed:   encrypted         = falseAdded:   encrypted         = trueAdded:   kms_key_id        = aws_kms_key.ebs.arn}

When it can be wrong

  • Leaving encrypted out is not reported, although the volume is then unencrypted unless the account default says otherwise.
  • Values that come from variables, modules or other resources are not checked, because Skylos does not run Terraform: cidr_blocks = var.admin_cidrs is not reported even when its default is 0.0.0.0/0.
  • It judges the declaration only. It does not know what is deployed, and other settings (account defaults, security groups, routing) can make the real exposure smaller or larger.

Seeing a case that isn't listed here? Report the wrong result so the rule can be fixed. Don't paste company code: describe the shape of it.

How to silence it

  • Terraform rules read no inline marker: # skylos: ignore[SKY-D406] on the resource line does not hide the finding.

  • [tool.skylos] ignore = ["SKY-D406"] turns the rule off for the project.

  • A baseline (skylos baseline ., then --baseline) accepts the declarations that exist today and reports new ones.

From the Skylos rule handbook, Skylos 5.8.0 (commit 5b880b0). All rules.