HashiCorp Certified: Terraform Associate — Question 109
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?
Answer options
- A. max(numcpus)
- B. ceil(numcpus)
- C. top(numcpus)
- D. high[numcpus]
Correct answer: A
Explanation
The correct answer is A, max(numcpus), because this function is specifically designed to return the highest value from a list of numbers. The other options, such as ceil and top, do not serve this purpose, and high is not a valid function in Terraform.