EMT Practice Test

1. Question Content...


Question List

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

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

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

Question4: Which statements best describes what the local variable assignment is doing in the following code snippet:

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

Question6: Your company has been using Terraform Cloud for a some time now . But every team is creating their own modules , and there is no standardization of the modules , with each team creating the resources in their own unique way . You want to enforce a standardization of the modules across the enterprise . What should be your approach.

Question7: Your manager has instructed you to start using terraform for the entire infra provisioning of the application stack. There are 4 environments - DEV , QA , UAT , and PROD. The application team has asked for complete segregation between these environments including the backend , state , and also configurations ,since there will be unique resources in different environments . What is the possible way to structure the terraform code to facilitate that.

Question8: Which of the following is considered a Terraform plugin?

Question9: If you delete a remote backend from the configuration, will you need to rebuild your state files locally?

Question10: terraform state subcommands such as list are read-only commands, do read-only commands create state backup files?

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

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

Question13: Your team has started using terraform OSS in a big way , and now wants to deploy multi region deployments (DR) in aws using the same terraform files . You want to deploy the same infra (VPC,EC2 ...) in both us-east-1 ,and us-west-2 using the same script , and then peer the VPCs across both the regions to enable DR traffic. But , when you run your script , all resources are getting created in only the default provider region. What should you do? Your provider setting is as below -
# The default provider configuration provider "aws" { region = "us-east-1" }

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

Question15: 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

Question16: From the code below, identify the implicit dependency:

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

Question18: When using parent/child modules to deploy infrastructure, how would you export a value from one module to import into another module.
For example, a module dynamically deploys an application instance or virtual machine, and you need the IP address in another module to configure a related DNS record in order to reach the newly deployed application.

Question19: The terraform init command is always safe to run multiple times, to bring the working directory up to date with changes in the configuration. Though subsequent runs may give errors, this command will never delete your existing configuration or state.

Question20: 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 doesn't become corrupt?

Question21: From the answers below, select the advantages of using Infrastructure as Code.

Question22: ABC Enterprise has recently tied up with multiple small organizations for exchanging database information. Due to this, the firewall rules are increasing and are more than 100 rules. This is leading firewall configuration file that is difficult to manage. What is the way this type of configuration can be managed easily?

Question23: Hanah is writing a terraform configuration with nested modules, there are multiple places where she has to use the same conditional expression but she wants to avoid repeating the same values or expressions multiple times in the configuration,. What is a better approach to dealing with this?

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

Question25: State locking does not happen automatically and must be specified at run

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

Question27: You cannot publish your own modules on the Terraform Registry.

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

Question29: You have created 2 workspaces PROD and RQA.
You have switched to RQA and provisioned RQA infrastructure from this workspace. Where is your state file stored?

Question30: What does terrafom plan do ?

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

Question32: How can you ensure that the engineering team who has access to git repo will not create any non-compliant resources that might lead to a security audit failure in future. your team is using Hashicorp Terraform Enterprise Edition.

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

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

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

Question36: Matt wants to import a manually created EC2 instance into terraform so that he can manage the EC2 instance through terraform going forward. He has written the configuration file of the EC2 instance before importing it to Terraform. Following is the code:
resource "aws_instance" "matt_ec2" { ami = "ami-bg2640de" instance_type = "t2.micro" vpc_security_group_ids = ["sg-6ae7d613", "sg-53370035"] key_name = "mysecret" subnet_id = "subnet-9e3cfbc5" } The instance id of that EC2 instance is i-0260835eb7e9bd40 How he can import data of EC2 to state file?

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

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

Question39: Select the most accurate statement to describe the Terraform language from the following list.

Question40: While using generic git repository as a module source, which of the below options allows terraform to select a specific version or tag instead of selecting the HEAD.

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

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

Question43: Named workspaces are not a suitable isolation mechanism for strong separation between staging and production?

Question44: You are reviewing Terraform configurations for a big project in your company. You noticed that there are several identical sets of resources that appear in multiple configurations. What feature of Terraform would you recommend to use to reduce the amount of cloned configuration between the different configurations?

Question45: What is the command you can use to set an environment variable named "var1"of type String?

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

Question47: You have been given requirements to create a security group for a new application. Since your organization standardizes on Terraform, you want to add this new security group with the fewest number of lines of code. What feature could you use to iterate over a list of required tcp ports to add to the new security group?

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

Question49: What is the default backend for Terraform?

Question50: A user has created a module called "my_test_module" and committed it to GitHub. Over time, several commits have been made with updates to the module, each tagged in GitHub with an incremental version number. Which of the following lines would be required in a module configuration block in terraform to select tagged version v1.0.4?

Question51: You are using a terraform operation that writes state. Unfortunately automatic state unlocking has failed for that operation. Which of the below commands can be used to remove the already acquired lock on the state?

Question52: Workspaces in Terraform provides similar functionality in the open-source, Terraform Cloud, and Enterprise versions of Terraform.

Question53: After running into issues with Terraform, you need to enable verbose logging to assist with troubleshooting the error. Which of the following values provides the MOST verbose logging?

Question54: In the following code snippet, the block type is identified by which string?

Question55: In order to make a Terraform configuration file dynamic and/or reusable, static values should be converted to use what?

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

Question57: You do not need to specify every required argument in the backend configuration. Omitting certain arguments may be desirable to avoid storing secrets, such as access keys, within the main configuration. When some or all of the arguments are omitted, we call this a _____________.

Question58: Once a resource is marked as tainted, the next plan will show that the resource will be _________ and ___________ and the next apply will implement this change.

Question59: After creating a new workspace "PROD" you need to run the command terraform select PROD to switch to it.

Question60: Which of the below options is the equivalent Terraform 0.12 version of the snippet which is written in Terraform 0.11?
"${var.instance_id}"

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

Question62: Which of the following state management command allow you to retrieve a list of resources that are part of the state file?

Question63: How does Terraform handle working with so many providers?

Question64: lookup retrieves the value of a single element from which of the below data type?

Question65: Your team lead does not trust the junior terraform engineers who now have access to the git repo . So , he wants you to have some sort of a checking layer , whereby , you can ensure that the juniors will not create any non-compliant resources that might lead to a security audit failure in future. What can you do to efficiently enforce this?

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

Question67: True or False: A list(...) contain a number of values of the same type while an object(...) can contain a number of values of different types.

Question68: Which of the below backends support state locking?

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

Question70: A variable az has the following default value. What will be the datatype of the variable?
az=["us-west-1a","us-east-1a"]

Question71: Your manager has instructed you to start using terraform for your day-to-day operations, but your security team is concerned about the terraform state files. They have heard it contains confidential information, and are worried that it will not be securely protected. What should be your response to the security team in this regard?

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

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

Question74: Which feature of Terraform allows multiple state files for a single configuration file depending upon the environment?

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

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