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

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

    Correct Answer: E

    When declaring a Terraform variable, no specific arguments like type, default, or description are required. You can declare a variable with just a name, and the other arguments are optional and meant to provide additional constraints or descriptions. Therefore, the correct option is 'None of the above.'

Discussion
Egger1992Option: 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

AWS_PT

it is not mandatory tough! E is correct

Shane_C

He selected E as his answer

gcpzOption: E

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.

AzRNoobOption: E

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.

Molly1994Option: E

they are all optional arguments for variable declarations. so E is correct none of them are required

samimshaikhOption: 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" { }

ghostGuiggsOption: E

E is the answer

Tyler2023Option: E

Correct, the answer is E https://developer.hashicorp.com/terraform/language/values/variables#disallowing-null-input-values

BereOption: 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 }

mirekbehanOption: E

Yes E is correct.

Shane_COption: E

E is correct

vj_dhaksh

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.

Ni33Option: E

E is the correct answer

FaaizzOption: E

Definitely E

campsOption: 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.

Power123Option: E

Answer is E. All are optional

sahara99Option: E

non of the options is mandatory - they are all optional

vikramvlrOption: E

Answer is E. we can declare the variable as variable "varname" {} type,default and description are optional..