Which of the following ate advantages of using infrastructure as code (laC) instead of provisioning with a graphical user interface (GUI)? Choose two correct answers.
Which of these actions will prevent two Terraform runs from changing the same state file at the same time?
You have a Terraform configuration that defines a single virtual machine with no references to it, You have run terraform apply to create the resource, and then removed the resource definition from your Terraform configuration file.
What will happen you run terraform apply in the working directory again?
Which of these are features of HCP Terraform/Terraform Cloud? (Pick the 2 correct responses)
What is the Terraform style convention for indenting a nesting level compared to the one above it?
If you update the version constraint in your Terraform configuration, Terraform will update your lock file the next time you run terraform Init.
You ate making changes to existing Terraform code to add some new infrastructure. When is the best time to run terraform validate?
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?
What functionality do providers offer in Terraform?(Pick 3 correct responses)
What feature stops multiple users from operating on the Terraform state at the same time?
Outside of the required_providers block, Terraform configurations always refer to providers by their local names.
What information does the public Terraform Module Registry automatically expose about published modules?
You created infrastructure outside the Terraform workflow that you now want to manage using Terraform. Which command brings the infrastructure into Terraform state?
What Terraform command always causes a state file to be updated with changes that might have been made outside of Terraform?
You 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 Terraform will delete.
Which command should you use to show all the resources that will be deleted? (Pick the 2 correct responses)
While attempting to deploy resources into your cloud provider using Terraform, you begin to see some odd behavior and experience slow responses. In order to troubleshoot you decide to turn on Terraform debugging. Which environment variables must be configured to make Terraform's logging more verbose?
Which of the following isnotan advantage of using Infrastructure as Code (IaC) operations?
You use a cloud provider account that is shared with other team members. You previously used Terraform to create a load balancer that listens on port 80. After application changes, you updated the Terraform code to change the port to 443.
You run terraform plan and see that the execution plan shows the port changing from 80 to 443 like you intended and step away to grab some coffee.
In the meantime, another team member manually changes the load balancer port to 443 through the cloud provider console before you get back to your desk.
What will happen when you run terraform apply upon returning to your desk?
terraform apply will fail if you have not run terraform plan first to update the plan output.
Which of the following is availableonlyinHCP Terraform workspacesandnot in Terraform CLI?
Terraform configuration (including any module references) can contain only one Terraform provider type.
Before you can use a new backend or HCP Terraform/Terraform Cloud integration, you must first execute terraform init.
How would you output returned values from a child module in the Terraform CLI output?
Which two steps are required to provision new infrastructure in the Terraform workflow? Choose two correct answers.
You add a new resource to an existing Terraform configuration, but do not update the version constraint in the configuration. The existing and new resources use the same provider. The working contains a .terraform.lock, hc1 file.
How will Terraform choose which version of the provider to use?
You have a list of numbers that represents the number of free CPU cores on each virtual cluster:
numcpus = [ 18, 3, 7, 11, 2 ]
What Terraform function could you use to select the largest number from the list?
You can develop a custom provider to manage its resources using Terraform.
If you manually destroy infrastructure, what is the best practice reflecting this change in Terraform?
You must use different Terraform commands depending on the cloud provider you use.
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?
You modified your Terraform configuration and run Terraform plan to review the changes. Simultaneously, your teammate manually modified the infrastructure component you are working on. Since you already ran terraform plan locally, the execution plan for terraform apply will be the same.
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 correct answers.
The Terraform binary version and provider versions must match each other in a single configuration.
You are using a networking module in your Terraform configuration with the name label my-network. In your main configuration you have the following code:
When you run terraform validate, you get the following error:
What must you do to successfully retrieve this value from your networking module?
In Terraform HCL, an object type of object({name=string, age-number}) would match this value.
When you initialize Terraform, where does it cache modules from the public Terraform Registry?
One remote backend configuration always maps to a single remote workspace.
Which of the following should you add in the required_providers block to define a provider version constraint?
What is the provider for the resource shown in the Exhibit?
resource "aws_vpc" "main" {
name = "test"
}
A resource block is shown in the Exhibit section of this page. How would you reference the attribute name of this resource in HCL?
If a module declares a variable with a default, that variable must also be defined within the module.
You are writing a child Terraform module that provisions an AWS instance. You want to reference the IP address returned by the child module in the root configuration. You name the instance resource "main'.
Which of these is the correct way to define the output value?
When you use a backend that requires authentication, it is best practice to:
A provider configuration block is required in every Terraform configuration.
Example: