Exam Terraform Associate All QuestionsBrowse all questions from this exam
Question 212

You have a list of numbers that represents the number of free CPU cores on each virtual cluster:

numcpus = [ 18, 3, 7, 11, 2 ]

What Terraform function could you use to select the largest number from the list?

    Correct Answer: A

    To select the largest number from a list in Terraform, you use the max function. The max function takes one or more numbers and returns the greatest number from the set. For the list of CPU cores, max(numcpus) will return the highest value, which is the desired outcome. Other options such as ceil, top, or high are not valid functions for this purpose in Terraform.

Discussion
gekkehenkOption: A

"max takes one or more numbers and returns the greatest number from the set."

ArizonaClassicsOption: A

A is correct See https://developer.hashicorp.com/terraform/language/functions/max