0% found this document useful (0 votes)
102 views11 pages

HashiCorp Test-King Terraform-Associate v2021-02-02 by Wangping 20q

The document describes an exam for the Terraform Associate certification. It contains 20 multiple choice questions about Terraform concepts and workflows. Correct answers are provided for each question along with a short explanation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
102 views11 pages

HashiCorp Test-King Terraform-Associate v2021-02-02 by Wangping 20q

The document describes an exam for the Terraform Associate certification. It contains 20 multiple choice questions about Terraform concepts and workflows. Correct answers are provided for each question along with a short explanation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Terraform Associate

Number: Terraform Associate


Passing Score: 800
Time Limit: 120 min
File Version: 1

Terraform Associate

https://www.gratisexam.com/

https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Exam A

QUESTION 1
The terraform.tfstate file always matches your currently built infrastructure.

A. True
B. False

https://www.gratisexam.com/

Correct Answer: B
Section: (none)
Explanation

Explanation/Reference:
Reference: https://www.terraform.io/docs/language/state/index.html

QUESTION 2
Which of the following is not true of Terraform providers?

A. Providers can be written by individuals


B. Providers can be maintained by a community of users
C. Some providers are maintained by HashiCorp
D. Major cloud vendors and non-cloud vendors can write, maintain, or collaborate on Terraform providers
E. None of the above

Correct Answer: D
Section: (none)
Explanation

Explanation/Reference:
Reference: https://jayendrapatil.com/terraform-cheat-sheet/#Terraform_Read_and_write_configuration

QUESTION 3
You should store secret data in the same version control repository as your Terraform configuration.

https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
A. True
B. False

Correct Answer: B
Section: (none)
Explanation

Explanation/Reference:
Reference: https://blog.gruntwork.io/a-comprehensive-guide-to-managing-secrets-in-your-terraform-code-1d586955ace1

QUESTION 4
You have provisioned some virtual machines (VMs) on Google Cloud Platform (GCP) using the gcloud command line tool. However, you are standardizing with
Terraform and want to manage these VMs using Terraform instead.

What are the two things you must do to achieve this? (Choose two.)

A. Provision new VMs using Terraform with the same VM names


B. Use the terraform import command for the existing VMs
C. Write Terraform configuration for the existing VMs
D. Run the terraform import-gcp command

Correct Answer: BD
Section: (none)
Explanation

Explanation/Reference:
Explanation:
The terraform import command is used to import existing infrastructure.
Import existing Google Cloud resources into Terraform with Terraformer.

Reference: https://www.terraform.io/docs/cli/import/usage.html
https://cloud.google.com/docs/terraform

QUESTION 5
terraform init initializes a sample main.tf file in the current directory.

A. True
B. False

https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Correct Answer: B
Section: (none)
Explanation

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

QUESTION 6
Which two steps are required to provision new infrastructure in the Terraform workflow? (Choose two.)

A. Destroy
B. Apply
C. Import
D. Init
E. Validate

Correct Answer: BD
Section: (none)
Explanation

Explanation/Reference:
Reference: https://www.terraform.io/guides/core-workflow.html

QUESTION 7
Terraform requires the Go runtime as a prerequisite for installation.

A. True
B. False

Correct Answer: B
Section: (none)
Explanation

Explanation/Reference:
Reference: https://www.terraform.io/docs/extend/guides/v1-upgrade-guide.html

QUESTION 8
When should you use the force-unlock command?

A. You see a status message that you cannot acquire the lock

https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
B. You have a high priority change
C. Automatic unlocking failed
D. Your apply failed due to a state lock

Correct Answer: C
Section: (none)
Explanation

Explanation/Reference:
Explanation:
Manually unlock the state for the defined configuration.

Reference: https://www.terraform.io/docs/cli/commands/force-unlock.html

QUESTION 9
You have used Terraform to create an ephemeral development environment in the cloud and are now ready to destroy all the infrastructure described by your
Terraform configuration. To be safe, you would like to first see all the infrastructure that will be deleted by Terraform.

Which command should you use to show all of the resources that will be deleted? (Choose two.)

A. Run terraform plan -destroy.


B. This is not possible. You can only show resources that will be created.
C. Run terraform state rm *.
D. Run terraform destroy and it will first output all the resources that will be deleted before prompting for approval.

Correct Answer: CD
Section: (none)
Explanation

Explanation/Reference:
Reference: https://www.terraform.io/docs/cli/commands/state/rm.html

QUESTION 10
What does the default "local" Terraform backend store?

A. tfplan files
B. Terraform binary
C. Provider plugins
D. State file

https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Correct Answer: D
Section: (none)
Explanation

Explanation/Reference:
Explanation:
The local backend stores state on the local filesystem, locks that state using system APIs, and performs operations locally.

Reference: https://www.terraform.io/docs/language/settings/backends/local.html

QUESTION 11
What value does the Terraform Cloud/Terraform Enterprise private module registry provide over the public Terraform Module Registry?

A. The ability to share modules with public Terraform users and members of Terraform Enterprise Organizations
B. The ability to tag modules by version or release
C. The ability to restrict modules to members of Terraform Cloud or Enterprise organizations
D. The ability to share modules publicly with any user of Terraform

Correct Answer: D
Section: (none)
Explanation

Explanation/Reference:
Explanation:
Terraform Registry is an index of modules shared publicly using this protocol. This public registry is the easiest way to get started with Terraform and find modules
created by others in the community.

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

QUESTION 12
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.)

A. { for o in var.list : o => o.id }


B. var.list[*].id
C. [ var.list[*].id ]
D. [ for o in var.list : o.id ]

https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Correct Answer: AB
Section: (none)
Explanation

Explanation/Reference:

QUESTION 13
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?

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

Correct Answer: A
Section: (none)
Explanation

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

QUESTION 14
Which option can not be used to keep secrets out of Terraform configuration files?

A. A Terraform provider
B. Environment variables
C. A -var flag
D. secure string

Correct Answer: C
Section: (none)
Explanation
https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
Explanation/Reference:
Reference: https://secrethub.io/blog/secret-management-for-terraform/

QUESTION 15
What is one disadvantage of using dynamic blocks in Terraform?

A. They cannot be used to loop through a list of values


B. Dynamic blocks can construct repeatable nested blocks
C. They make configuration harder to read and understand
D. Terraform will run more slowly

Correct Answer: A
Section: (none)
Explanation

Explanation/Reference:
Reference: https://github.com/hashicorp/terraform/issues/19291

QUESTION 16
Only the user that generated a plan may apply it.

A. True
B. False

Correct Answer: A
Section: (none)
Explanation

Explanation/Reference:
Explanation:
The optional -out argument can be used to save the generated plan to a file for later execution with terraform apply, which can be useful when running Terraform in
automation.
Reference: https://learn.hashicorp.com/tutorials/terraform/automate-terraform

QUESTION 17
Examine the following Terraform configuration, which uses the data source for an AWS AMI.

What value should you enter for the ami argument in the AWS instance resource?

https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
A. aws_ami.ubuntu
B. data.aws_ami.ubuntu
C. data.aws_ami.ubuntu.id
D. aws_ami.ubuntu.id

Correct Answer: C
Section: (none)
Explanation

Explanation/Reference:
Explanation:
resource "aws_instance" "web" {
ami = data.aws_ami.ubuntu.id

Reference: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/instance

QUESTION 18
What is the name assigned by Terraform to reference this resource?

https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
A. dev
B. azurerm_resource_group
C. azurerm
D. test

Correct Answer: D
Section: (none)
Explanation

Explanation/Reference:

QUESTION 19
Where in your Terraform configuration do you specify a state backend?

A. The terraform block


B. The resource block
C. The provider block
D. The datasource block

Correct Answer: A
Section: (none)
Explanation

Explanation/Reference:
Explanation:
Backends are configured with a nested backend block within the top-level terraform block.

Reference: https://www.terraform.io/docs/language/settings/backends/configuration.html

QUESTION 20
How would you reference the "name" value of the second instance of this fictitious resource?

https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2
A. element(aws_instance.web, 2)
B. aws_instance.web[1].name
C. aws_instance.web[1]
D. aws_instance.web[2].name
E. aws_instance.web.*.name

Correct Answer: A
Section: (none)
Explanation

Explanation/Reference:
Reference: https://www.terraform.io/docs/configuration-0-11/interpolation.html

https://www.gratisexam.com/

https://www.gratisexam.com/
885CB989129A5F974833949052CFB2F2

You might also like