EMT Practice Test

1. Question Content...


Question List

Question1: Complete the following sentence:
The terraform state command can be used to ____

Question2: Every region in AWS has a different AMI ID for Linux and these are keep on changing. What is the best approach to create the EC2 instances that can deal with different AMI IDs based on regions?

Question3: terraform init initializes a sample main.tf file in the current directory.

Question4: Which provisioner invokes a process on the resource created by Terraform?

Question5: Which of the following value will be accepted for my_var?
1. variable "my_var"
2. {
3. type = string
4. }

Question6: Which backend does the Terraform CLI use by default?

Question7: 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?

Question8: What happens when a terraform apply command is executed?

Question9: You have provisioned some aws resources in your test environment through Terraform for a POC work. After the POC, now you want to destroy the resources but before destroying them you want to check what resources will be getting destroyed through terraform. what are the options of doing that? (Select TWO)

Question10: 1. resource "aws_s3_bucket" "example" {
2. bucket = "my-test-s3-terraform-bucket"
3. ...} resource "aws_iam_role" "test_role" {
4. name = "test_role"
5. ...}
Due to the way that the application code is written, the s3 bucket must be created before the test role is created, otherwise there will be a problem. How can you ensure that?

Question11: Which of the below configuration file formats are supported by Terraform? (Select TWO)

Question12: terraform validate validates the syntax of Terraform files.

Question13: Provisioners should only be used as a last resort.

Question14: What information does the public Terraform Module Registry automatically expose about published modules?

Question15: Terraform and Terraform providers must use the same major version number in a single configuration.

Question16: Which one of the following command will rewrite Terraform configuration files to a canonical format and style.

Question17: You have written a terraform IaC script which was working till yesterday , but is giving some vague error from today , which you are unable to understand . You want more detailed logs that could potentially help you troubleshoot the issue , and understand the root cause. What can you do to enable this setting? Please note , you are using terraform OSS.

Question18: 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.)

Question19: Complete the following sentence:
For local state, the workspaces are stored directly in a ___________.

Question20: If you enable TF_LOG = DEBUG, the log will be stored in syslog.log file in the currect directory.

Question21: Given the Terraform configuration below, in which order will the resources be created?
1. resource "aws_instance" "web_server"
2. {
3. ami = "ami-b374d5a5"
4. instance_type = "t2.micro"
5. }
6. resource "aws_eip" "web_server_ip"
7. {
8. vpc = true instance = aws_instance.web_server.id
9. }

Question22: Using multi-cloud and provider-agnostic tools provides which of the following benefits?

Question23: Mary has created a database instance in AWS and for ease of use is outputting the value of the database password with the following code:
1. output "db_password"
2. {
3. value = local.db_password
4. }
Mary wants to hide the output value in the CLI after terraform apply? What is the best way?

Question24: Which task does terraform init not perform?

Question25: Please identify the offerings which are unique to Terraform Enterprise, and not available in either Terraform OSS, or Terraform Cloud. Select four.

Question26: What is a downside to using the Vault provider to read secrets from Vault?

Question27: A terraform apply can not _________ infrastructure.

Question28: What command does Terraform require the first time you run it within a configuration directory?

Question29: 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.

Question30: Which flag would you add to terraform plan to save the execution plan to a file?
Type your answer in the field provided. The text field is not case-sensitive and all variations of the correct answer are accepted.

Question31: When writing Terraform code, HashiCorp recommends that you use how many spaces between each nesting level?

Question32: Terraform provisioners can be added to any resource block.

Question33: Jim has created several AWS resources from a single terraform configuration file. Someone from his team has manually modified one of the EC2 instance.
Now to discard the manual change, Jim wants to destroy and recreate the EC2 instance. What is the best way to do it?

Question34: Which of the following clouds does not have a provider maintained HashiCorp?

Question35: 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.

Question36: What feature of Terraform Cloud and/or Terraform Enterprise can you publish and maintain a set of custom modules which can be used within your organization?

Question37: Which of the following Terraform files should be ignored by Git when committing code to a repo? (select Three)

Question38: Module variable assignments are inherited from the parent module and do not need to be explicitly set.

Question39: 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?

Question40: What is one disadvantage of using dynamic blocks in Terraform?

Question41: Taint the resource "aws_instance" "baz" resource that lives in module bar which lives in module foo.

Question42: What is the result of the following terraform function call?

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

Question44: Which of the following challenges would Terraform be a candidate for solving? (Select THREE)

Question45: Which of the following value will be accepted for var1?
variable "var1" {
type = string
}

Question46: A fellow developer on your team is asking for some help in refactoring their Terraform code. As part of their application's architecture, they are going to tear down an existing deployment managed by Terraform and deploy new. However, there is a server resource named aws_instance.ubuntu[1] they would like to keep to perform some additional analysis.
What command should be used to tell Terraform to no longer manage the resource?

Question47: Which argument(s) is (are) required when declaring a Terraform variable?

Question48: In order to reduce the time it takes to provision resources, Terraform uses parallelism. By default, how many resources will Terraform provision concurrently?

Question49: When should you use the force-unlock command?

Question50: Select the feature below that best completes the sentence:
The following list represents the different types of __________ available in Terraform.
1. max
2. min
3. join
4. replace
5. list
6. length
7. range

Question51: 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?

Question52: Which statement describes a goal of infrastructure as code?

Question53: 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?

Question54: Which of the following command can be used to view the specified version constraints for all providers used in the current configuration.

Question55: Setting the TF_LOG environment variable to DEBUG causes debug messages to be logged into syslog.

Question56: When using remote state, state is only ever held in memory when used by Terraform.

Question57: What is the purpose of using the local-exec provisioner? (Select Two)

Question58: Terraform-specific settings and behaviors are declared in which configuration block type?

Question59: You have created a custom variable definition file testing.tfvars. How will you use it for provisioning infrastructure?

Question60: A Terraform provisioner must be nested inside a resource configuration block.

Question61: Why might a user opt to include the following snippet in their configuration file?

Question62: Which of the following connection types are supported by the remote-exec provisioner? (select two)

Question63: Provider dependencies are created in several different ways. Select the valid provider dependencies from the following list: (select three)

Question64: What resource dependency information is stored in Terraform's state?

Question65: A single terraform resource file that defines an aws_instance resource can simple be renamed to azurerm_virtual_machine in order to switch cloud providers

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

Question67: If a module uses a local variable, you can expose that value with a terraform output.

Question68: If a module declares a variable with a default, that variable must also be defined within the module.

Question69: You have deployed a new webapp with a public IP address on a clod 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?

Question70: 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 __________.

Question71: Which of the following type of variable allows multiple values of several distinct types to be grouped together as a single value?

Question72: You have declared a variable name my_var in terraform configuration without a value associated with it.
variable my_var {}
After running terraform plan it will show an error as variable is not defined.

Question73: You want to know from which paths Terraform is loading providers referenced in your Terraform configuration (*.tf files). You need to enable debug messages to find this out.
Which of the following would achieve this?

Question74: Dawn has created the below child module. Without changing the module, can she override the instance_type from t2.micro to t2.large form her code while calling this module?
1. resource "aws_instance" "myec2"
2. {
3. ami = "ami-082b5a644766e0e6f"
4. instance_type = "t2.micro
5. }

Question75: Command terraform refresh will update state file?

Question76: True or False? terraform init cannot automatically download Community providers.

Question77: Terraform can run on Windows or Linux, but it requires a Server version of the Windows operating system.

Question78: A single terraform resource file that defines an aws_instance resource can simply be renamed to vsphere_virtual_machine in order to switch cloud providers.

Question79: Which of the below options is a valid interpolation syntax for retrieving a data source?

Question80: Terraform Cloud always encrypts state at rest and protects it with TLS in transit. Terraform Cloud also knows the identity of the user requesting state and maintains a history of state changes.

Question81: 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.)

Question82: You would like to reuse the same Terraform configuration for your development and production environments with a different state file for each.
Which command would you use?

Question83: Ric wants to enable detail logging and he wants highest verbosity of logs. Which of the following environment variable settings is correct option for him to select.

Question84: Terraform provisioners that require authentication can use the ______ block.

Question85: What does the default "local" Terraform backend store?

Question86: What is the workflow for deploying new infrastructure with Terraform?

Question87: What is the name of the default file where Terraform stores the state?
Type your answer in the field provided. The text field is not case-sensitive and all variations of the correct answer are accepted.

Question88: 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)

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

Question90: A Terraform provider is not responsible for:

Question91: You write a new Terraform configuration and immediately run terraform apply in the CLI using the local backend.
Why will the apply fail?

Question92: You want to use terraform import to start managing infrastructure that was not originally provisioned through infrastructure as code. Before you can import the resource's current state, what must you do in order to prepare to manage these resources using Terraform?

Question93: Which one is the right way to import a local module names consul?

Question94: Which of the following is not a valid Terraform collection type?

Question95: Given the below resource configuration -
resource "aws_instance" "web" { # ... count = 4 }
What does the terraform resource address aws_instance.web refer to?

Question96: How can you trigger a run in a Terraform Cloud workspace that is connected to a Version Control System (VCS) repository?

Question97: Anyone can publish and share modules on the Terraform Public Module Registry, and meeting the requirements for publishing a module is extremely easy. Select from the following list all valid requirements. (select three)

Question98: A data block requests that Terraform read from a given data source and export the result under the given local name.

Question99: State is a requirement for Terraform to function

Question100: Which of the following is not an action performed by terraform init?

Question101: When you initialize Terraform, where does it cache modules from the public Terraform Module Registry?

Question102: What kind of resource dependency is stored in terraform.tfstate file?

Question103: You want to get involved in the development of Terraform. As this is an open source project, you would like to contribute a fix for an open issue of Terraform. What programming language will need to use to write the fix?

Question104: Terraform import command can import resources into modules as well directly into the root of your state.

Question105: Which option can not be used to keep secrets out of Terraform configuration files?

Question106: The terraform state command can be used to ____

Question107: Which of the following actions are performed during a terraform init?

Question108: You have created two workspaces PROD and DEV. You have switched to DEV and provisioned DEV infrastructure from this workspace. Where is your state file stored?

Question109: What command should you run to display all workspaces for the current configuration?

Question110: Only the user that generated a plan may apply it.

Question111: You wanted to destroy some of the dependent resources from real infrastructure. You choose to delete those resources from your configuration file and run terraform plan and then apply. Which of the following way your resources would be destroyed?