Free Terraform Associate Exam Braindumps (page: 23)

Page 22 of 113

You need to constrain the GitHub provider to version 2.1 or greater.
Which of the following should you put into the Terraform 0.12 configuration’s provider block?

  1. version >= 2.1
  2. version ~> 2.1
  3. version = “<= 2.1”
  4. version = “>= 2.1”

Answer(s): D

Explanation:

version = ">= 1.2.0, < 2.0.0"
A version constraint is a string literal containing one or more conditions, which are separated by commas.
Each condition consists of an operator and a version number.
Version numbers should be a series of numbers separated by periods (like 1.2.0), optionally with a suffix to indicate a beta release.

The following operators are valid:
= (or no operator): Allows only one exact version number. Cannot be combined with other conditions.
!=: Excludes an exact version number.
>, >=, <, <=: Comparisons against a specified version, allowing versions for which the comparison is true. "Greater-than" requests newer versions, and "less-than" requests older versions.
~>: Allows only the rightmost version component to increment. For example, to allow new patch releases within a specific minor release, use the full version number: ~> 1.0.4 will allow installation of 1.0.5 and 1.0.10 but not 1.1.0. This is usually called the pessimistic constraint operator.


Reference:

https://www.terraform.io/language/expressions/version-constraints



You just scaled your VM infrastructure and realized you set the count variable to the wrong value. You correct the value and save your change.
What do you do next to make your infrastructure match your configuration?

  1. Run an apply and confirm the planned changes
  2. Inspect your Terraform state because you want to change it
  3. Reinitialize because your configuration has changed
  4. Inspect all Terraform outputs to make sure they are correct

Answer(s): A



Terraform provisioners that require authentication can use the block.

  1. connection
  2. credentials
  3. secrets
  4. ssh

Answer(s): A

Explanation:

"Most provisioners require access to the remote resource via SSH or WinRM and expect a nested connection block with details about how to connect." "Connection blocks don't take a block label and can be nested within either a resource or a provisioner."


Reference:

https://www.terraform.io/language/resources/provisioners/connection



Terraform validate reports syntax check errors from which of the following scenarios?

  1. Code contains tabs indentation instead of spaces
  2. There is missing value for a variable
  3. The state files does not match the current infrastructure
  4. None of the above

Answer(s): B

Explanation:

The terraform validate command is used to validate the syntax of the terraform files. Terraform performs a syntax check on all the terraform files in the directory, and will display an error if any of the files doesn't validate. This command does not check formatting (e.g. tabs vs spaces, newlines, comments etc.). The following can be reported: invalid HCL syntax (e.g. missing trailing quote or equal sign) invalid HCL references (e.g. variable name or attribute which doesn't exist) same provider declared multiple times same module declared multiple times same resource declared multiple times invalid module name interpolation used in places where it's unsupported (e.g. variable, depends_on, module.source, provider) missing value for a variable (none of -var foo=... flag, -var- file=foo.vars flag, TF_VAR_foo environment variable, terraform.tfvars, or default value in the configuration)


Reference:

https://learning-ocean.com/tutorials/terraform/terraform-validate
https://www.typeerror.org/docs/terraform/commands/validate






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

Terraform Associate Discussions & Posts