Terraform associate Exam questions 1-50

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

Why would you use the terraform taint command? A. When you want to force Terraform to destroy a resource on the next apply B. When you want to force Terraform to destroy and recreate a resource on the next apply C. When you want Terraform to ignore a resource on the next apply D. When you want Terraform to destroy all the infrastructure in your workspace

B

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? data "aws_ami" "ubuntu" { ... } resource "aws_instance" "web" { ami = ____________________________ instance_type = "t2.micro" tags = { Name = "HelloWorld" } } A. aws_ami.ubuntu B. data.aws_ami.ubuntu C. data.aws_ami.ubuntu.id D. aws_ami.ubuntu.id

C

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

C

What command does Terraform require the first time you run it within a configuration directory? A. terraform import B. terraform init C. terraform plan D. terraform workspace

B

What is not processed when running a terraform refresh? A. State file B. Configuration file C. Credentials D. Cloud provider

B

Which of the following is not a key principle of infrastructure as code? A. Versioned infrastructure B. Golden images C. Idempotence D. Self-describing infrastructure

B

Which provisioner invokes a process on the resource created by Terraform? A. remote-exec B. null-exec C. local-exec D. file

A

Only the user that generated a plan may apply it. A. True B. False

B

Setting the TF_LOG environment variable to DEBUG causes debug messages to be logged into syslog. A. True B. False

B

Terraform can run on Windows or Linux, but it requires a Server version of the Windows operating system. A. True B. False

B

Terraform requires the Go runtime as a prerequisite for installation. A. True B. False

B

Terraform variables and outputs that set the "description" argument will store that description in the state file. A. True B. False

B

The terraform.tfstate file always matches your currently built infrastructure. A. True B. False

B

How is the Terraform remote backend different than other state backends such as S3, Consul, etc.? A. It can execute Terraform runs on dedicated infrastructure on premises or in Terraform Cloud B. It doesn't show the output of a terraform apply locally C. It is only available to paying customers D. All of the above

A

If a module uses a local values, you can expose that value with a terraform output. A. True B. False

A

If you manually destroy infrastructure, what is the best practice reflecting this change in Terraform? A. Run terraform refresh B. It will happen automatically C. Manually update the state fire D. Run terraform import

A

Terraform can import modules from a number of sources `" which of the following is not a valid source? A. FTP server B. GitHub repository C. Local path D. Terraform Module Registry

A

What is the name assigned by Terraform to reference this resource? resource "azurerm_resource_group" "dev" { name = "test" location = "westus" } A. dev B. azurerm_resource_group C. azurerm D. test

A

Which of the following is available only in Terraform Enterprise or Cloud workspaces and not in Terraform CLI? A. Secure variable storage B. Support for multiple cloud providers C. Dry runs with terraform plan D. Using the workspace as a data source

A

You have multiple team members collaborating on infrastructure as code (IaC) using Terraform, and want to apply formatting standards for readability. How can you format Terraform HCL (HashiCorp Configuration Language) code according to standard Terraform style convention? A. Run the terraform fmt command during the code linting phase of your CI/CD process B. Designate one person in each team to review and format everyone's code C. Manually apply two spaces indentation and align equal sign "=" characters in every Terraform file (*.tf) D. Write a shell script to transform Terraform files using tools such as AWK, Python, and sed

A

You run a local-exec provisioner in a null resource called null_resource.run_script and realize that you need to rerun the script. Which of the following commands would you use first? A. terraform taint null_resource.run_script B. terraform apply -target=null_resource.run_script C. terraform validate null_resource.run_script D. terraform plan -target=null_resource.run_script

A

terraform validate validates the syntax of Terraform files. A. True B. False

A

A Terraform provisioner must be nested inside a resource configuration block. A. True B. False

A (B - 35%)

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.

A D

One remote backend configuration always maps to a single remote workspace. A. True B. False

B

You have never used Terraform before and would like to test it out using a shared team account for a cloud provider. The shared team account already contains 15 virtual machines (VM). You develop a Terraform configuration containing one VM, perform terraform apply, and see that your VM was created successfully. What should you do to delete the newly-created VM with Terraform? A. The Terraform state file contains all 16 VMs in the team account. Execute terraform destroy and select the newly-created VM. B. The Terraform state file only contains the one new VM. Execute terraform destroy. C. Delete the Terraform state file and execute Terraform apply. D. Delete the VM using the cloud provider console and terraform apply to apply the changes to the Terraform state file.

B

You should store secret data in the same version control repository as your Terraform configuration. A. True B. False

B

terraform init initializes a sample main.tf file in the current directory. A. True B. False

B

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

B C

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

B D

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 ]

B D

A provider configuration block is required in every Terraform configuration. Example: pvorider "provider_name" { ... } A.True B.False

B(58%) - A(42%)

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

C

When should you use the force-unlock command? A. You see a status message that you cannot acquire the lock B. You have a high priority change C. Automatic unlocking failed D. You apply failed due to a state lock

C

When using a module block to reference a module stored on the public Terraform Module Registry such as: module "consul" { source = "hashicorp/consul/aws" } 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

C

Where does the Terraform local backend store its state? A. In the /tmp directory B. In the terraform file C. In the terraform.tfstate file D. In the user's terraform.state file

C

Which of the following is not a valid string function in Terraform? A. split B. join C. slice D. chomp

C

You have deployed a new webapp with a public IP address on a cloud provider. However, you did not create any outputs for your code. What is the best method to quickly find the IP address of the resource you deployed? A. Run terraform output ip_address to view the result B. In a new folder, use the terraform_remote_state data source to load in the state file, then write an output for each resource that you find the state file C. Run terraform state list to find the name of the resource, then terraform state show to find the attributes including public IP address D. Run terraform destroy then terraform apply and look for the IP address in stdout

C

What features does the hosted service Terraform Cloud provide? (Choose two.) A. Automated infrastructure deployment visualization B. Automatic backups C. Remote state storage D. A web-based user interface (UI)

C D

What does the default "local" Terraform backend store? A. tfplan files B. Terraform binary C. Provider plugins D. State file

D

What information does the public Terraform Module Registry automatically expose about published modules? A. Required input variables B. Optional inputs variables and default values C. Outputs D. All of the above E. None of the above

D

What is the workflow for deploying new infrastructure with Terraform? A. terraform plan to import the current infrastructure to the state file, make code changes, and terraform apply to update the infrastructure. B. Write a Terraform configuration, run terraform show to view proposed changes, and terraform apply to create new infrastructure. C. terraform import to import the current infrastructure to the state file, make code changes, and terraform apply to update the infrastructure. D. Write a Terraform configuration, run terraform init, run terraform plan to view planned infrastructure changes, and terraform apply to create new infrastructure.

D

Which of the following is the correct way to pass the value in the variable num_servers into a module with the input servers? A. servers = num_servers B. servers = variable.num_servers C. servers = var(num_servers) D. servers = var.num_servers

D

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

D

Which task does terraform init not perform? A. Sources all providers present in the configuration and ensures they are downloaded and available locally B. Connects to the backend C. Sources any modules and copies the configuration locally D. Validates all required variables are present

D

You have recently started a new job at a retailer as an engineer. As part of this new role, you have been tasked with evaluating multiple outages that occurred during peak shopping time during the holiday season. Your investigation found that the team is manually deploying new compute instances and configuring each compute instance manually. This has led to inconsistent configuration between each compute instance. How would you solve this using infrastructure as code? A. Implement a ticketing workflow that makes engineers submit a ticket before manually provisioning and configuring a resource B. Implement a checklist that engineers can follow when configuring compute instances C. Replace the compute instance type with a larger version to reduce the number of required deployments D. Implement a provisioning pipeline that deploys infrastructure configurations committed to your version control system following code reviews

D

Which argument(s) is (are) required when declaring a Terraform variable? A. type B. default C. description D. All of the above E. None of the above

E

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

E

FILL BLANK - You need to specify a dependency manually. What resource meta-parameter can you use to make sure Terraform respects the dependency? Type your answer in the field provided. The text field is not case-sensitive and all variations of the correct answer are accepted.

depends_on


संबंधित स्टडी सेट्स

Chapter 3 LearnSmart Questions-HW

View Set

Microeconomics Online Spring 2019 John Yarber NEMCC

View Set

Chapter 51: Nursing Care of a Family when a Child has a Musculoskeletal Disorder

View Set

Ch 1 - Introduction to Emergency Medical Care - Complete the Following

View Set

Pathophys Week 4 Check Your Understanding

View Set

ENH 121 Unit 3 Part 1: Constitutional Law

View Set

Converting decimals to fractions and vice versa

View Set

PHR Study Session #6: Risk Management

View Set