SKY-D406 · Deployment and infrastructure
Terraform creates an unencrypted EBS volume
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 towardmax_highandmax_security; the rule never reports CRITICAL. - Finding type
- review
- Catalog name
- Terraform AWS EBS volume encryption disabled
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
resource "aws_ebs_volume" "uploads" { availability_zone = "eu-west-1a" size = 200 type = "gp3" encrypted = false}What Skylos leaves alone
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
- Runs with
--danger(or-a). Reads.tfand.tf.jsonfiles, skipping.terraform,.git,node_modules,vendor,build,distand virtual-environment folders, and parses them as HCL without running Terraform or contacting AWS. - Resolves only literal values and
localvalues 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. - Skips a resource with
count = 0or an emptyfor_each, and needs the official AWS provider (hashicorp/aws, which anaws_resource uses unless another provider is configured). - Checks
aws_ebs_volumeresources. - Reports when
encryptedis the literalfalse. A volume made from a snapshot (snapshot_id) is not judged, because it inherits the snapshot's encryption, and neither is akms_key_idwithoutencrypted = true. - Reports HIGH on the
resourceline. 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).
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
encryptedout 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_cidrsis not reported even when its default is0.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.