exam questions

Exam Terraform Associate All Questions

View all questions & answers for the Terraform Associate exam

Exam Terraform Associate topic 1 question 39 discussion

Actual exam question from HashiCorp's Terraform Associate
Question #: 39
Topic #: 1
[All Terraform Associate Questions]

Which argument(s) is (are) required when declaring a Terraform variable?

  • A. type
  • B. default
  • C. description
  • D. All of the above
  • E. None of the above
Show Suggested Answer Hide Answer
Suggested Answer: E 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Egger1992
Highly Voted 2 years, 8 months ago
Selected Answer: E
The type argument in a variable block allows you to restrict the type of value that will be accepted as the value for a variable. If no type constraint is set then a value of any type is accepted. Source: https://www.terraform.io/language/values/variables
upvoted 31 times
AWS_PT
2 years, 1 month ago
it is not mandatory tough! E is correct
upvoted 2 times
Shane_C
1 year, 5 months ago
He selected E as his answer
upvoted 2 times
...
...
...
gcpz
Highly Voted 2 years, 8 months ago
Correct is E Terraform CLI defines the following OPTIONAL arguments for variable declarations: default - A default value which then makes the variable optional. type - This argument specifies what value types are accepted for the variable. description - This specifies the input variable's documentation. validation - A block to define validation rules, usually in addition to type constraints. sensitive - Limits Terraform UI output when the variable is used in configuration. nullable - Specify if the variable can be null within the module.
upvoted 17 times
...
anand0310
Most Recent 3 months, 4 weeks ago
Selected Answer: E
E is correct
upvoted 1 times
...
Molly1994
6 months, 3 weeks ago
they are all optional arguments for variable declarations. so E is correct none of them are required
upvoted 1 times
...
samimshaikh
12 months ago
Selected Answer: E
we can define variables without type, default, and description. default argument will require and value when terraform apply is executed. So in the context of this question is it required and answer is not variable "prefix" { } variable "location" { }
upvoted 1 times
...
ghostGuiggs
1 year, 1 month ago
Selected Answer: E
E is the answer
upvoted 1 times
...
Tyler2023
1 year, 2 months ago
Correct, the answer is E https://developer.hashicorp.com/terraform/language/values/variables#disallowing-null-input-values
upvoted 1 times
...
Bere
1 year, 5 months ago
Selected Answer: E
When declaring a variable in Terraform, no arguments are required. However, there are optional arguments you can include for clarity and readability: description: This is a string that describes the purpose of the variable. default: This is the default value that Terraform will use if no other value is provided. type: This constrains the type of value the variable will accept, such as string, list, map, number, or bool. Here's an example of a variable declaration with no arguments: variable "example" { } And here's an example with all optional arguments included: variable "example" { description = "An example variable used for demonstration purposes" default = "Hello, World!" type = string }
upvoted 1 times
...
mirekbehan
1 year, 5 months ago
Selected Answer: E
Yes E is correct.
upvoted 1 times
...
Shane_C
1 year, 5 months ago
E is correct
upvoted 1 times
...
vj_dhaksh
1 year, 6 months ago
Arguments Terraform CLI defines the following optional arguments for variable declarations: default - A default value which then makes the variable optional. type - This argument specifies what value types are accepted for the variable. description - This specifies the input variable's documentation. validation - A block to define validation rules, usually in addition to type constraints. sensitive - Limits Terraform UI output when the variable is used in configuration. nullable - Specify if the variable can be null within the module.
upvoted 1 times
...
Ni33
1 year, 7 months ago
Selected Answer: E
E is the correct answer
upvoted 1 times
...
AzRNoob
1 year, 8 months ago
E is correct. It is possible to declare a variable without any of the given arguments (type, default, description). In fact, a variable declaration only requires a name and an optional type constraint. So the correct answer is E. None of the above.
upvoted 2 times
...
Faaizz
1 year, 8 months ago
Selected Answer: E
Definitely E
upvoted 1 times
...
camps
1 year, 9 months ago
Selected Answer: E
None of the above arguments are required when declaring a Terraform variable. However, at least one of the following arguments is required: type: Specifies the data type of the variable. Valid types include string, number, bool, list, map, and object. default: Specifies the default value of the variable. If no default value is specified, the variable is considered required and must be set by the user when running Terraform. description: Provides a description of the variable and its intended use. This is optional but recommended to make the purpose of the variable clear to users. In addition to these arguments, there are several other optional arguments that can be used when declaring a Terraform variable, including validation, sensitive, and allowed_values.
upvoted 1 times
...
Power123
1 year, 9 months ago
Answer is E. All are optional
upvoted 1 times
...
sahara99
1 year, 10 months ago
Selected Answer: E
non of the options is mandatory - they are all optional
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago