Terraform: Unable to create encrypted EBS on aws_instance

Created on 15 Mar 2015  ยท  4Comments  ยท  Source: hashicorp/terraform

When creating an aws_instance, with an encrypted EBS, I get unexpected errors:

Error launching source instance: the encrypted flag cannot be specified since device /dev/sda1 has a snapshot specified. (InvalidBlockDeviceMapping)

No snapshot is specified, so the error does not make sense to me:

    block_device = {
         device_name = "/dev/sda1"
         volume_type = "gp2"
         volume_size = "15"
         encrypted = true
         delete_on_termination = true
    }

Setting encrypted to false drops the error with terraform apply.

provideaws

Most helpful comment

Is there no way to make the root an encrypted device?

All 4 comments

@ketzacoatl You might be getting this error because it looks like you're referring to the root EBS volume and you're launching an EBS backed instance. These instances ALWAYS have a snapshot for the root volume. (Go ahead and launch a t2.micro, you'll see what I'm saying)

Thanks @bkett, you would be correct - I needed to have two block_device maps, one for the root and one for the encrypted device.

Is there no way to make the root an encrypted device?

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.

Was this page helpful?
0 / 5 - 0 ratings