Complete the code to fetch availability zones in the current region.
data "aws_availability_zones" "available" { state = "[1]" }
The state attribute must be set to available to fetch zones that are currently available.
Complete the code to output the list of availability zone names.
output "az_names" { value = data.aws_availability_zones.available.[1] }
The names attribute returns the list of availability zone names.
Fix the error in the data source block to correctly filter zones by state.
data "aws_availability_zones" "filtered" { state = "[1]" }
The correct state filter value is available to get usable availability zones.
Fill both blanks to create a data source that fetches only available zones and outputs their count.
data "aws_availability_zones" "example" { state = "[1]" } output "az_count" { value = length(data.aws_availability_zones.example.[2]) }
Set state to available to get usable zones, and use names to count them.
Fill all three blanks to create a data source fetching available zones, output their names, and output their count.
data "aws_availability_zones" "all" { state = "[1]" } output "all_az_names" { value = data.aws_availability_zones.all.[2] } output "all_az_count" { value = length(data.aws_availability_zones.all.[3]) }
Use available for state, and names for both outputs to list and count zones.