HashiCorp Certified: Terraform Associate Practice Exam 2020 – Exam 2 (Q31-Q57)

HashiCorp Certified: Terraform Associate Practice Exam 2020 – Exam 2 (Q31-Q57) Cuongquach.com | Bộ đề ôn thi chứng chỉ HashiCorp Certified: Terraform Associate , Bộ đề số 2 với những câu hỏi trọng tâm trong năm 2020 và 2021 về kiến thức sử dụng công cụ Terraform quản lý hạ tầng dịch vụ. Bộ đề số 2, bao gồm 57 câu hỏi chia ra làm nhiều bài viết, bạn đang ở bài viết bao gồm câu hỏi 31 đến câu hỏi 57 của bộ đề 2.

Có thể bạn quan tâm phần 1 – Exam 2:
HashiCorp Certified: Terraform Associate Practice Exam 2020 – Exam 2 (Q1-Q30)

Nếu bạn cảm thấy câu trả lời của các câu hỏi có sự không chính xác hoặc băn khoăn về đáp án, thì đừng ngại bình luận ở dưới.

HashiCorp Certified: Terraform Associate Test Exam, questionnaire number 2 focus on knowledge of using Terraform to manage infrastructure. Questionare Exam 2, consists of 56 questions divided into multiple articles, you are in the post including questions 31 to 57 of the Questionare Exam 2

terraform-associate-exam-02-part-2

Terraform Associate Practice Exam 2020 – Exam 2 – Question 31 to 57

Question 31

Oscar is modifying his Terraform configuration file but isn’t 100% sure it’s correct. He is afraid that changes made could negatively affect production workloads. How can Oscar validate the changes that will be made without impacting existing workloads?

A. run a terraform plan and validate the changes that will be made
B. run terraform apply using a local-exec provisioner so the configuration won’t impact existing workloads
C. run terraform refresh to compare his existing configuration file against the current one
D.
run a terraform validate to ensure the changes won’t impact the production workloads

Answer
A

Question 32

What is the result of the following terraform function call?

> zipmap(["a", "b"], [1, 2])
A.
{
  "a" = 1
  "b" = 2
}
B.
{
  "a",
  "b",
  "1",
  "2",
}
C.
[
  "a" = 1
  "b" = 2
]
D.
[
  "a",
  "b",
  "1",
  "2",
]

Answer
A

Question 33

Complete the following sentence:

The terraform state command can be used to ____

A. modify the current state, such as removing items
B. refresh the existing state
C. create a new state file
D. there is no such command

Answer
A

Question 34

When using constraint expressions to signify a version of a provider, which of the following are valid provider versions that satisfy the expression found in the following code snippet: (select two)

terraform {
  required_providers {
    aws = "~> 1.2.0"
  }
}
A.
1.3.0
B. 1.2.3
C. 1.3.1
D. 1.2.9

Answer
B, D

Question 35

True or False? Each Terraform workspace uses its own state file to manage the infrastructure associated with that particular workspace.

A. False
B. True

Answer
B

Question 36

A user runs terraform init on their RHEL based server and per the output, two provider plugins are downloaded:

$ terraform init
 
Initializing the backend...
 
Initializing provider plugins...
- Checking for available provider plugins...
- Downloading plugin for provider "aws" (hashicorp/aws) 2.44.0...
- Downloading plugin for provider "random" (hashicorp/random) 2.2.1...
 
Terraform has been successfully initialized!

Where are these plugins downloaded to?

A. The .terraform.plugins directory in the directory terraform init was executed in.
B. The .terraform/plugins directory in the directory terraform init was executed in.
C.
The .terraform.d directory in the directory terraform init was executed in.
D. /etc/terraform/plugins

Answer
B

Question 37

When Terraform needs to be installed in a location where it does not have internet access to download the installer and upgrades, the installation is generally known as to be __________.

A.
a private install
B. disconnected
C.
air-gapped
D. non-traditional

Answer
C

Question 38

During a terraform apply, a resource is successfully created but eventually fails during provisioning. What happens to the resource?

A. the resource is marked as tainted
B. the terraform plan is rolled back and all provisioned resources are removed
C. Terraform attempts to provision the resource up to three times before exiting with an error
D.
it is automatically deleted

Answer
A

Question 39

Terraform Enterprise (also referred to as pTFE) requires what type of backend database for a clustered deployment?

A. PostgreSQL
B.
MySQL
C. Cassandra
D. MSSQL

Answer
A

Question 40

Which of the following is not a valid Terraform string function?

A. join
B. tostring
C. format
D. replace

Answer
B

Question 41

Which are some of the benefits of using Infrastructure as Code in general? (select three)

A. it is always platform agnostic
B.
it can be versioned
C.
it can be shared
D. it can be reused

Answer
B, C, D

Question 42

Terraform has detailed logs which can be enabled by setting the _________ environmental variable.

A.
TF_DEBUG
B.
TF_INFO
C.
TF_LOG
D.
TF_TRACE

Answer
C

Question 43

Freddy and his co-worker Jason are deploying resources in GCP using Terraform for their team. After resources have been deployed, they need to destroy the cloud-based resources to save on costs. However, two other team members, Michael and Chucky, are using a Cloud SQL instance for testing and are asking to keep it running.

How can Freddy and Jason easily destroy all other resources without negatively impacting the database?

A. delete the entire state file using the terraform state rm command and manually delete the other resources in GCP
B. take a snapshot of the database, run a terraform destroy, and then recreate the database in the GCP console by restoring the snapshot
C. run a terraform state rm command to remove the Cloud SQL instance from Terraform management before running the terraform destroy command
D. run a terraform destroy, modify the configuration file to include only the Cloud SQL resource, and then run a terraform apply

Answer
C

Question 44

Emma is a Terraform expert, and she has automated all the things with Terraform. During a recent deployment, a virtual machine was deployed but a local script did not work correctly, and therefore needs to be destroyed and recreated. How can Emma easily have Terraform recreate this one resource without having to destroy everything that was created?

A. use terraform import to import the error so Terraform is aware of the problem
B. use terraform refresh to refresh the state and make Terraform aware of the error
C. use terraform state rm to remove the resource from the state file, which will cause Terraform to recreate the instance again
D. use terraform taint to mark the virtual machine as tainted

Answer
D

Question 45

Which of the following statements best describes the Terraform list(...) type?

A.
a collection of values where each is identified by a string label.
B. a collection of named attributes that each have their own type
C. a collection of unique values that do not have any secondary identifiers or ordering.
D. a sequence of values identified by consecutive whole numbers starting with zero.

Answer
D

Question 46

Whenever you add a new module to a configuration, Terraform must install the module before it can be used. What two commands can be used to install and update modules? (select two)

A. terraform refresh
B. terraform init
C. terraform get
D. terraform plan

Answer
B, C

Question 47

Terraform is distributed as a single binary and available for many different platforms. Select all Operating Systems that Terraform is available for. (select five)

A. Windows
B. Linux
C. MacOS
D. Solaris
E. FreeBSD
F. Unix

Answer
A, B, C, D, E

Question 48

True or False? The terraform refresh command is used to reconcile the state Terraform knows about (via its state file) with the real-world infrastructure. If drift is detected between the real-world infrastructure and the last known-state, it will modify the infrastructure to correct the drift.

A. True
B. False

Answer
B

Question 49

Which of the following variable declarations is going to result in an error?

A.
variable "example" { 
  description = "This is a test"
  type        = map
  default     = {"one" = 1, "two" = 2, "Three" = "3"}
}
B.
variable "example" { 
  description = "This is a variable description" 
  type        = list(string) 
  default     = {}
}
C.
variable "example" {}
D.
variable "example" { 
  type = object({})
}

Answer
B

Question 50

Terraform Cloud is more powerful when you integrate it with your version control system (VCS) provider. Select all the supported VCS providers from the answers below. (select four)

A. Azure DevOps Server
B. Github Enterprise
C. Github
D. Bitbucket Cloud
E. CVS Version Control

Answer
A, B, C, D

Question 51

Sara has her entire application automated using Terraform, but she now needs to start including more infrastructure pieces, such as creating a new subnet, DNS record, and load balancer. Like the Terraform pro she is, Sara requires that these new resources be created within modules so she can easily reuse the code later. However, Sara is having problems getting the subnet_id from the subnet module to pass to the load balancer module. What could fix this problem?

A. publish the module to a Terraform registry first
B. add an output to the subnet module and reference it using module.subnet.subnet_id in the load balancer module
C. move the subnet and load balancer resource into the main configuration file so they can easily be referenced
D. references to resources in a module cannot be used within other modules

Answer
B

Question 52

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.

A. TF_ENV_VAR
B.
TF_VAR_NAME
C. TF_ENV
D. TF_VAR

Answer
D

Question 53

True or False? When using the Terraform provider for Vault, the tight integration between these HashiCorp tools provides the ability to mask secrets in the terraform plan and state files.

A. True
B. False

Answer
B

Question 54

Which of the following commands will launch the Interactive console for Terraform interpolations?

A.
terraform cli
B. terraform
C.
terraform console
D. terraform cmdline

Answer
C

Question 55

A “backend” in Terraform determines how state is loaded and how an operation such as apply is executed. Which of the following is not a supported backend type?

A. s3
B. terraform enterprise
C.
github
D. artifactory
E. consul

Answer
C

Question 56

While Terraform is generally written using the HashiCorp Configuration Language (HCL). What other syntax can Terraform be expressed in?

A. JSON
B. XML
C. YAML
D. TypeScript

Answer
A

Question 57

Select all features which are exclusive to Terraform Enterprise and Terraform Cloud for Business (select three).

A.
Self-Service Infrastructure
B. Cost Estimation
C. Audit Logging
D. Sentinel
E. SAML/SSO

Answer
A, C, E

Reference: LINK

Nguồn: https://cuongquach.com/

Previous articleHashiCorp Certified: Terraform Associate Practice Exam 2020 – Exam 2 (Q1-Q30)
Next articleHướng dẫn đăng ký thi chứng chỉ Terraform Associate
Bạn đang theo dõi website "https://cuongquach.com/" nơi lưu trữ những kiến thức tổng hợp và chia sẻ cá nhân về Quản Trị Hệ Thống Dịch Vụ & Mạng, được xây dựng lại dưới nền tảng kinh nghiệm của bản thân mình, Quách Chí Cường. Hy vọng bạn sẽ thích nơi này !