Free Terraform Associate Exam Braindumps (page: 11)

Page 10 of 113

Which task does terraform init not perform?

  1. Sources all providers present in the configuration and ensures they are downloaded and available locally
  2. Connects to the backend
  3. Sources any modules and copies the configuration locally
  4. Validates all required variables are present

Answer(s): D


Reference:

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



You have declared a variable called var.list which is a list of objects that all have an attribute id.
Which options will produce a list of the IDs? (Choose two.)

  1. { for o in var.list : o => o.id }
  2. var.list[*].id
  3. [ var.list[*].id ]
  4. [ for o in var.list : o.id ]

Answer(s): B,D

Explanation:

A splat expression provides a more concise way to express a common operation that could otherwise be performed with a for expression.


Reference:

https://www.terraform.io/language/expressions/splat



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

  1. type
  2. default
  3. description
  4. All of the above
  5. None of the above

Answer(s): B

Explanation:

The variable declaration can also include a default argument.


Reference:

https://www.terraform.io/docs/language/values/variables.html



When using a module block to reference a module stored on the public Terraform Module Registry such as:


How do you specify version 1.0.0?

  1. Modules stored on the public Terraform Module Registry do not support versioning
  2. Append ?ref=v1.0.0 argument to the source path
  3. Add version = "1.0.0" attribute to module block
  4. Nothing – modules stored on the public Terraform Module Registry always default to version 1.0.0

Answer(s): C

Explanation:

Version
When using modules installed from a module registry, we recommend explicitly constraining the acceptable version numbers to avoid unexpected or unwanted changes.
Use the version argument in the module block to specify versions: module "consul" {
source = "hashicorp/consul/aws"
version = "0.0.5"
servers = 3
}


Reference:

https://www.terraform.io/docs/language/modules/sources.html






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

Terraform Associate Discussions & Posts