HashiCorp Certified: Terraform Associate Practice Exam 2020 – Exam 1 (Q1-Q30)

HashiCorp Certified: Terraform Associate Practice Exam 2020 – Exam 1 (Q1-Q30)Cuongquach.com | Bộ đề ôn thi chứng chỉ HashiCorp Certified: Terraform Associate , Bộ đề số 1 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ố 1, bao gồm 56 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 1 đến câu hỏi 30 của bộ đề 1.

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

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 1 focus on knowledge of using Terraform to manage infrastructure. Questionare Exam 1, consists of 56 questions divided into multiple articles, you are in the post including questions 1 to 30 of the Questionare Exam 1

terraform-associate-exam-01-part-1

Terraform Associate Practice Exam 2020 – Exam 1 – Question 1 to 30

Question 1:

Rick is writing a new Terraform configuration file and wishes to use modules in order to easily consume Terraform code that has already been written. Which of the modules shown below will be created first?

terraform {
  required_providers {
    aws = {
      source = "hashicorp/aws"
    }
  }
}
 
provider "aws" {
  region = "us-west-2"
}
 
module "vpc" {
  source  = "terraform-aws-modules/vpc/aws"
  version = "2.21.0"
 
  name = var.vpc_name
  cidr = var.vpc_cidr
 
  azs             = var.vpc_azs
  private_subnets = var.vpc_private_subnets
  public_subnets  = var.vpc_public_subnets
 
  enable_nat_gateway = var.vpc_enable_nat_gateway
 
  tags = var.vpc_tags
}
 
module "ec2_instances" {
  source  = "terraform-aws-modules/ec2-instance/aws"
  version = "2.12.0"
 
  name           = "my-ec2-cluster"
  instance_count = 2
 
  ami                    = "ami-0c5204531f799e0c6"
  instance_type          = "t2.micro"
  vpc_security_group_ids = [module.vpc.default_security_group_id]
  subnet_id              = module.vpc.public_subnets[0]
 
  tags = {
    Terraform   = "true"
    Environment = "dev"
  }
}
A. module “vpc”
B. module “ec2_instance”

Answer
A
[su_su_spoiler title=”Answer” open=”yes” style=”fancy” icon=”chevron”]A[/su_spoiler]

Question 2:

From the answers below, select the advantages of using Infrastructure as Code. (select four)

A. Easily integrate with application workflows (GitLab Actions, Azure DevOps, CI/CD tools)
B. Safely test modifications using a “dry run” before applying any actual changes
C. Easily change and update existing infrastructure
D. Provide a codified workflow to develop customer-facing applications
E. Provide reusable modules for easy sharing and collaboration

Answer
A , B , C , E

Question 3

After executing a terraform apply, you notice that a resource has a tilde (~) next to it. What does this infer?

A. Terraform can’t determine how to proceed due to a problem with the state file
B. the resource will be updated in place
C. the resource will be created
D. the resource will be destroyed and recreated

Answer
B

Question 4

Which Terraform command will force a marked resource to be destroyed and recreated on the next apply?

A. terraform refresh
B. terraform taint
C. terraform destroy
D. terraform fmt

Answer
B

Question 5

Kristen is using modules to provision an Azure environment for a new application. She is using the following code and specifying a version of her virtual machine module to ensure she’s calling the correct module. Which of the following provides support for versioning of a module? (select two)

module "compute" {
  source  = "Azure/compute/azurerm"
  version = "3.8.0"
}
A. private module registry
B. public module registry
C. modules stored in GitLab
D. local file paths

Answer
A, B

Question 6

In regards to deploying resources in multi-cloud environments, what are some of the benefits of using Terraform rather than a provider’s native tooling? (select three)

A Terraform simplifies management and orchestration, helping operators build large-scale, multi-cloud infrastructure
B Terraform can manage cross-cloud dependencies
C Terraform is not cloud-agnostic and can be used to deploy resources across a single public cloud
D Terraform can help businesses deploy applications on multiple clouds and on-premises infrastructure

Answer
A, B, D

Question 7

In the example below, where is the value of the DNS record’s IP address originating from?

resource "aws_route53_record" "www" {
  zone_id = aws_route53_zone.primary.zone_id
  name    = "www.helloworld.com"
  type    = "A"
  ttl     = "300"
  records = [module.web_server.instance_ip_addr]
}
A by querying the AWS EC2 API to retrieve the IP address
B value of the web_server parameter from the variables.tf file
C the regular expression named module.web_server
D the output of a module named web_server

Answer
D

Question 8

Which of the following represents a feature of Terraform Cloud that is NOT free to customers?

A team management and governance
B private module registry
C workspace management
D VCS integration

Answer
A

Question 9

What are the core Terraform workflow steps to use infrastructure as code?

A 1) Plan
2) Apply
3) Destroy
B 1) Plan
2) Apply
3) Pray
C 1) Write
2) Plan
3) Apply
D 1) Code
2) Validate
3) Apply

Answer
C

Question 10

When multiple engineers start deploying infrastructure using the same state file, what is a feature of remote state storage that is critical to ensure the state does not become corrupt?

A workspaces
B encryption
C state locking
D object storage

Answer
C

Question 11

Which flag would be used within a Terraform configuration block to identify the specific version of a provider required?

A required_providers
B required-version
C required-provider
D required_versions

Answer
A

Question 12

Published modules via the Terraform Registry provide which of the following benefits? (select four)

A automatically generated documentation
B allow browsing version histories
C show examples and READMEs
D support from any code repo
E support versioning

Answer
A, B, C, E

Question 13

What are some of the features of Terraform state? (select three)

A mapping configuration to real-world resources
B determining the correct order to destroy resources
C inspection of cloud resources
D increased performance

Answer
A, B, D

Question 14

Which of the following best describes the default local backend?

A The local backend is how Terraform connects to public cloud services, such as AWS, Azure, or GCP.
B The local backend is where Terraform Enterprise stores logs to be processed by an log collector.
C The local backend is the directory where resources deployed by Terraform have direct access to in order to update their current state.
D The local backend stores state on the local filesystem, locks the state using system APIs, and performs operations locally.

Answer
D

Question 15

True or False? State is a requirement for Terraform to function.

A True
B False

Answer
A

Question 16

True or False? Starting in Terraform v0.12, the Terraform language now has built-in syntax for creating lists using the [ and ] delimiters, replacing and deprecating the list () function.

A False
B True

Answer
B

Question 17

Stephen is writing brand new code and needs to ensure it is syntactically valid and internally consistent. Stephen doesn’t want to wait for Terraform to access any remote services while making sure his code is valid. What command can he use to accomplish this?

A terraform show
B terraform validate
C terraform fmt
D terraform refresh

Answer
B

Question 18

When configuring a remote backend in Terraform, it might be a good idea to purposely omit some of the required arguments to ensure secrets and other relevant data are not inadvertently shared with others. What are the ways the remaining configuration can be added to Terraform so it can initialize and communicate with the backend? (select three)

A command-line key/value pairs
B interactively on the command line
C directly querying HashiCorp Vault for the secrets
D use the -backend-config=PATH to specify a separate config file

Answer
A, B, D

Question 19

In Terraform Enterprise, a workspace can be mapped to how many VCS repos?

A 1
B 5
C 3
D 2

Answer
A

Question 20

True or False? Workspaces provide identical functionality in the open-source, Terraform Cloud, and Enterprise versions of Terraform.

A False
B True

Answer
A

Question 21

What are the benefits of using Infrastructure as Code? (select five)

A Infrastructure as Code allows a user to turn a manual task into a simple, automated deployment
B Infrastructure as Code gives the user the ability to recreate an application’s infrastructure for disaster recovery scenarios
C Infrastructure as Code is easily repeatable, allowing the user to reuse code to deploy similar, yet different resources
D Infrastructure as Code is relatively simple to learn and write, regardless of a user’s prior experience with developing code
E Infrastructure as Code easily replaces development languages such as Go and .Net for application development
F Infrastructure as Code provides configuration consistency and standardization among deployments

Answer
A, B, C, D, F

Question 22

What does the command terraform fmt do?

A deletes the existing configuration file
B rewrite Terraform configuration files to a canonical format and style
C formats the state file in order to ensure the latest state of resources can be obtained
D updates the font of the configuration file to the official font supported by HashiCorp

Answer
B

Question 23

Select two answers to complete the following sentence:

Before a new provider can be used, it must be ______ and _______. (select two)

A initialized
B approved by HashiCorp
C declared or used in a configuration file
D uploaded to source control

Answer
A, C

Question 24

Which of the following allows Terraform users to apply policy as code to enforce standardized configurations for resources being deployed via infrastructure as code?

A functions
B module registry
C workspaces
D sentinel

Answer
D

Question 25

What happens when a terraform plan is executed?

A reconciles the state Terraform knows about with the real-world infrastructure
B creates an execution plan and determines what changes are required to achieve the desired state in the configuration files.
C applies the changes required in the target infrastructure in order to reach the desired configuration
D the backend is initialized and the working directory is prepped

Answer
B

Question 26:

Which of the following is considered a Terraform plugin?

A. terraform tooling
B. terraform provider
C. terraform language
D. terraform logic

Answer
B

Question 27

Frank has a file named main.tf which is shown below. Which of the following statements are true about this code?

module "servers" {
  source = "./app-cluster"
 
  servers = 5
}
A. main.tf is the calling module
B. main.tf is the child module
C. app-cluster is the child module
D. app-cluster is calling module

Answer
A, C

Question 28

What are some of the problems of how infrastructure was traditionally managed before Infrastructure as Code? (select three)

A. Traditionally managed infrastructure can’t keep up with cyclic or elastic applications
B. Requests for infrastructure or hardware required a ticket, increasing the time required to deploy applications
C. Traditional deployment methods are not able to meet the demands of the modern business where resources tend to live days to weeks, rather than months to years
D. Pointing and clicking in a management console is a scalable approach and reduces human error as businesses are moving to a multi-cloud deployment model

Answer
A, B, C

Question 29

What happens when a terraform apply command is executed?

A. the backend is initialized and the working directory is prepped
B. reconciles the state Terraform knows about with the real-world infrastructure
C. applies the changes required in the target infrastructure in order to reach the desired configuration
D. creates the execution plan for the deployment of resources

Answer
C

Question 30

Which of the following actions are performed during a terraform init? (select three)

A. initializes the backend configuration
B. provisions the declared resources in your configuration
C. download the declared providers which are supported by HashiCorp
D. initializes downloaded and/or installed providers

Answer
A, C, D

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

Previous articleCấu hình tính năng Variable Validation trong Terraform
Next articleHashiCorp Certified: Terraform Associate Practice Exam 2020 – Exam 1 (Q31-Q56)
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 !