Free Terraform Associate Exam Braindumps (page: 29)

Page 28 of 113

Environment variables can be used to set variables. The environment variables must be in the format " "_<variablename>. Select the correct prefix string from the following list.

  1. TF_CLI_ARGS
  2. TF_VAR
  3. TF_VAR_
  4. TF_VAR_ENV

Answer(s): C

Explanation:

Environment variables can be used to set variables. The environment variables must be in the format TF_VAR_name and this will be checked last for a value. For example:
export TF_VAR_region=us-west-1 export TF_VAR_ami=ami-049d8641 export TF_VAR_alist='[1,2,3]'
export TF_VAR_amap='{ foo = "bar", baz = "qux" }' https://www.terraform.io/docs/commands/environment-variables.html



The terraform init command is always safe to run multiple times, to bring the working directory up to date with changes in the configuration. Though subsequent runs may give errors, this command will never delete your existing configuration or state.

  1. False
  2. True

Answer(s): B


Reference:

https://www.terraform.io/docs/commands/init.html



ABC Enterprise has recently tied up with multiple small organizations for exchanging database information. Due to this, the firewall rules are increasing and are more than 100 rules. This is leading firewall configuration file that is difficult to manage. What is the way this type of configuration can be managed easily?

  1. Terraform Backends
  2. Terraform Functions
  3. Dynamic Blocks
  4. Terraform Expression

Answer(s): C



True or False: A list(...) contain a number of values of the same type while an object(...) can contain a number of values of different types.

  1. False
  2. True

Answer(s): B

Explanation:

Collection Types
A collection type allows multiple values of one other type to be grouped together as a single value. The type of value within a collection is called its element type. All collection types must have an element type, which is provided as the argument to their constructor.
For example, the type list(string) means "list of strings", which is a different type than list(number), a list of numbers. All elements of a collection must always be of the same type.
The three kinds of collection type in the Terraform language are:
* list(...): a sequence of values identified by consecutive whole numbers starting with zero. The keyword list is a shorthand for list(any), which accepts any element type as long as every element is the same type. This is for compatibility with older configurations; for new code, we recommend using the full form.
* map(...): a collection of values where each is identified by a string label.
The keyword map is a shorthand for map(any), which accepts any element type as long as every element is the same type. This is for compatibility with older configurations; for new code, we recommend using the full form.
* set(...): a collection of unique values that do not have any secondary identifiers or ordering. https://www.terraform.io/docs/configuration/types.html
Structural Types
A structural type allows multiple values of several distinct types to be grouped together as a single value. Structural types require a schema as an argument, to specify which types are allowed for which elements.
The two kinds of structural type in the Terraform language are:
* object(...): a collection of named attributes that each have their own type.
The schema for object types is { <KEY> = <TYPE>, <KEY> = <TYPE>, ... } — a pair of curly braces containing a comma-separated series of <KEY> = <TYPE> pairs. Values that match the object type must contain all of the specified keys, and the value for each key must match its specified type. (Values with additional keys can still match an object type, but the extra attributes are discarded during type conversion.)
* tuple(...): a sequence of elements identified by consecutive whole numbers starting with zero, where each element has its own type.

The schema for tuple types is [<TYPE>, <TYPE>, ...] — a pair of square brackets containing a comma- separated series of types. Values that match the tuple type must have exactly the same number of elements (no

more and no fewer), and the value in each position must match the specified type for that position. For example: an object type of object({ name=string, age=number }) would match a value like the following:
{
name = "John" age = 52
}
Also, an object type of object({ id=string, cidr_block=string }) would match the object produced by a reference to an aws_vpc resource, like aws_vpc.example_vpc; although the resource has additional attributes, they would be discarded during type conversion.
Finally, a tuple type of tuple([string, number, bool]) would match a value like the following: ["a", 15, true]


Reference:

https://www.terraform.io/docs/configuration/types.html






Post your Comments and Discuss HashiCorp Terraform Associate exam with other Community members:

Terraform Associate Discussions & Posts