Terraform Vairalbe Requirments

Hi, This may be a basic question but really would like to know the specifics.

Question is, what arguments are required when declaring a variable?

The Terraform documentation says (default, type, description, validation, sensitive) all these arguments are optional

As it says all of those are optional. The only required item is the name of the variable, which is part of the variable block itself. I would suggest setting the type & description as a good practice. You would need to set default if the variable is to be optional, otherwise Terraform will error unless it is supplied.

1 Like