TA-002-P · Question #277
Which of the following value will be accepted for my_var? 1. variable "my_var" 2. { 3. type = string 4. }
The correct answer is C. Both A and B. The Terraform language will automatically convert number and bool values to string values when needed, and vice-versa as long as the string contains a valid representation of a number or true converts to "true", and vice-versa false converts to "false", and vice-versa * 15…
Question
Options
- A15
- B"15"
- CBoth A and B
- DNone of the above
How the community answered
(52 responses)- A2% (1)
- B4% (2)
- C92% (48)
- D2% (1)
Explanation
The Terraform language will automatically convert number and bool values to string values when needed, and vice-versa as long as the string contains a valid representation of a number or * true converts to "true", and vice-versa * false converts to "false", and vice-versa * 15 converts to "15", and vice-versa Where possible, Terraform automatically converts values from one type to another in order to produce the expected type. If this isn't possible, Terraform will produce a type mismatch error and you must update the configuration with a more suitable expression.
Topics
Community Discussion
No community discussion yet for this question.