Terraform "Unsupported block type" in CI
A configuration declares a nested block the resource/provider schema does not define -- a misspelled block, a block from a different resource, or one removed/renamed in a provider version.
What this error means
validate/plan fails with "Unsupported block type", naming the block. It often surfaces after a provider major upgrade that restructured a block, or copy-pasting a block onto the wrong resource.
Error: Unsupported block type
on main.tf line 9, in resource "aws_instance" "app":
9: ebs_block_device {
Blocks of type "ebs_block_device" are not expected here.Common causes
Block not valid for this resource
The nested block belongs to a different resource, or is misspelled, so the schema does not recognize it.
Block restructured in a provider upgrade
A provider major version may move a nested block to a separate resource or rename it, breaking old config.
How to fix it
Use the correct block for the schema
Check the provider docs for the resource version and use the supported block (or its replacement resource).
# newer aws provider: use the standalone resource
resource "aws_ebs_volume" "data" {
availability_zone = "us-east-1a"
size = 100
}
resource "aws_volume_attachment" "data" {
device_name = "/dev/sdh"
volume_id = aws_ebs_volume.data.id
instance_id = aws_instance.app.id
}Fix typos and misplacement
- Confirm the block name matches the resource schema exactly.
- Ensure the block is inside the resource that defines it.
- Pin the provider version so the schema is predictable.
How to prevent it
- Read provider upgrade guides before bumping major versions.
- Run terraform validate in CI to catch unsupported blocks.
- Pin provider versions for a stable schema.