Terraform

What's the result of the following code?

resource "random_integer" "num" {
  min = 20
  max = 17
}

resource "aws_instance" "instances" {
  count = random_integer.num.results
}

Difficulty: unrated

Source: bregman-arie/devops-exercises by Arie Bregman

Answer

The above code will fail as it's not possible to reference resource outputs with count, because Terraform has to compute count before any resources are created (or modified).