A configuration contains the block: data "aws_ami" "ubuntu" { ... }. Which expression correctly references the AMI's id attribute from a resource?
Choose one.
Each kind of named value in Terraform has its own address prefix: managed resources have no prefix (TYPE.NAME), data sources use data., input variables use var., and local values use local.
Because the block is a data source, its attributes are addressed as data.aws_ami.ubuntu.id. Dropping the data. prefix (option a) would point at a managed resource with the same type and name, which is a different object entirely. The var. and local. prefixes belong to input variables and locals and never address data sources.
- Identify the block kind: data "aws_ami" "ubuntu" is a data source.
- Apply the data source address form: data.TYPE.NAME.
- Append the attribute you need: data.aws_ami.ubuntu.id.
Exam tip: Resources have no prefix, data sources use data., variables use var., and locals use local.
Terraform Resources, Data Sources, Variables, and Outputs — the lesson that teaches this.