nerdexam
HashiCorp

TERRAFORM-ASSOCIATE-004 · Question #11

How would you reference the volume IDs associated with the ebs_block_device blocks in this configuration?

The correct answer is D. aws_instance.example-ebs_block_device.*.volume_id. To reference attributes across multiple ebs_block_device blocks, Terraform uses the legacy splat expression (.). Option A uses invalid bracket/comma syntax. Option B has a typo (aws_lnstance with a lowercase L) and an extra dot before the brackets (.[]). Option C incorrectly uses

Submitted by diego_uy· Apr 18, 2026Work with Terraform Configurations

Question

How would you reference the volume IDs associated with the ebs_block_device blocks in this configuration?

Options

  • Aaws_instance.example.ebs_block_device[sda2,sda3).volume_id
  • Baws_lnstance.example.ebs_block_device.[*].volume_id
  • Caws_lnstance.example.ebs_block_device.volume_ids
  • Daws_instance.example-ebs_block_device.*.volume_id

How the community answered

(64 responses)
  • A
    6% (4)
  • B
    3% (2)
  • C
    11% (7)
  • D
    80% (51)

Explanation

To reference attributes across multiple ebs_block_device blocks, Terraform uses the legacy splat expression (.*). Option A uses invalid bracket/comma syntax. Option B has a typo (aws_lnstance with a lowercase L) and an extra dot before the brackets (.[*]). Option C incorrectly uses a plural attribute name volume_ids, which doesn't exist. Option D - aws_instance.example.ebs_block_device.*.volume_id - uses the correct legacy splat operator to iterate over all ebs_block_device blocks and return a list of their volume_id attributes. (Note: the hyphen in choice D appears to be a typographical artifact in the question; the intended syntax is with a dot separator.)

Topics

#Terraform Language#Splat Expression#Resource Attributes#Nested Blocks

Community Discussion

No community discussion yet for this question.

Full TERRAFORM-ASSOCIATE-004 Practice