Which is a benefit of using infrastructure as code (IaC) tools compared to native platform APIs?
Exhibit:
resource " azurerm_linux_web_app " " app " {
name = " example-app "
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
service_plan_id = azurerm_service_plan.plan.id
identity {
type = " UserAssigned "
identity_ids = [azurerm_user_assigned_identity.app.id]
}
}
resource " azurerm_role_assignment " " kv_access " {
scope = azurerm_key_vault.kv.id
role_definition_name = " Key Vault Secrets User "
principal_id = azurerm_user_assigned_identity.app.principal_id
}
Two resource blocks are shown: azurerm_linux_web_app and azurerm_role_assignment. When provisioned, the web app will use the role assignment during creation, so the role assignment must be created first. How do you ensure the azurerm_role_assignment resource is created first?
You want to use API tokens and other secrets within your team ' s Terraform workspaces. Where does HashiCorp recommend you store these sensitive values?
(Pick 3 correct responses)
When should you write Terraform configuration files for existing infrastructure that you want to start managing with Terraform?
Your team is collaborating on infrastructure using Terraform and wants to format code to follow Terraform language style conventions. How can you update your code to meet these requirements?
What kind of configuration block will manage an infrastructure object with settings specified within the block?
Your root module contains a variable namednum_servers. Which is the correct way to pass its value to a child module with an input namedservers?
Which of the following can you do with terraform plan?
Pick the two correct responses below.
You modified your Terraform configuration to fix a typo in the resource ID by renaming it from photoes to photos. What configuration will you add to update the resource ID in state without destroying the existing resource?
Original configuration:
resource " aws_s3_bucket " " photoes " {
bucket_prefix = " images "
}
Updated configuration:
resource " aws_s3_bucket " " photos " {
bucket_prefix = " images "
}
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?
Exhibit:
provider " aws " { region = " us-east-1 " }
provider " aws " { region = " us-west-2 " }
You need to deploy resources into two different AWS regions in the same Terraform configuration using the provider blocks shown in the exhibit. What do you need to add to the provider configuration to deploy a resource to the us-west-2 AWS region?
You add a new provider to your configuration and immediately run terraform apply in the CD using the local backend. Why does the apply fail?
Which of the following is availableonlyinHCP Terraform workspacesandnot in Terraform CLI?
Which of the following locations can Terraform use as aprivate sourcefor modules?(Pick 2 correct responses)
Changing the Terraform backend from the default " local " backend to a different one after performing your first terrafom apply is:
What command can you run to generateDOT (Graphviz)formatted data to visualize Terraform dependencies?
You created infrastructure outside the Terraform workflow that you now want to manage using Terraform. Which command brings the infrastructure into Terraform state?
A resource block is shown in the Exhibit space of this page. How would you reference the name value of the second instance of this resource?
Which command must you first run before performing further Terraform operations in a working directory?
Module variable assignments are inherited from the parent module and you do not need to explicitly set them.
You can access state stored with the local backend by using terraform_remote_state data source.
Which type of block fetches or computes information for use elsewhere in a Terraform configuration?
When you run terraform apply, the Terraform CLI will print output values from both the root module and any child modules.
Module version is required to reference a module on the Terraform Module Registry.
A module block is shown in the Exhibit space of this page. When you use a module block to reference a module from the Terraform Registry such as the one in the example, how do you specify version 1.0.0 of the module?
Exhibit:
resource " aws_instance " " example " {
ami = " ami-0a123456789abcdef "
instance_type = " t3.micro "
}
You are updating a child module with the resource block shown in the exhibit. The public_ip attribute of the resource needs to be accessible to the parent module. How do you meet this requirement?
You want to use API tokens and other secrets within your team ' s Terraform workspaces. Where does HashiCorp recommend you store these sensitive values? (Pick 3)
What Terraform command always causes a state file to be updated with changes that might have been made outside of Terraform?
What is the Terraform style convention for indenting a nesting level compared to the one above it?
What does Terraform not reference when running a terraform apply -refresh-only ?
Running terraform fmt without any flags in a directory with Terraform configuration files check the formatting of those files without changing their contents.
As a developer, you want to ensure your plugins are up to date with the latest versions. Which Terraform command should you use?
Your Terraform configuration declares a variable. You want to enforce that its value meets your specific requirements, and you want to block the Terraform operation if it does not. What should you add to your configuration?
If you update the version constraint in your Terraform configuration, Terraform will update your lock file the next time you run terraform Init.
How can a ticket-based system slow down infrastructure provisioning and limit the ability to scale? Choose two correct answers.
Which argument can you use toprevent unexpected updatesto a module ' s configuration when calling Terraform Registry modules?
You want to define a single input variable to capture configuration values for a server. The values must represent memory as a number, and the server name as a string.
Which variable type could you use for this input?
A senior admin accidentally deleted some of your cloud instances. What will Terraform do when you run terraform apply?
You’ve updated your Terraform configuration, and you need to preview the proposed changes to your infrastructure. Which command should you run?
A developer on your team is going to leaf down an existing deployment managed by Terraform and deploy a new one. However, there is a server resource named aws instant.ubuntu[l] they would like to keep. What command should they use to tell Terraform to stop managing that specific resource?
You ate making changes to existing Terraform code to add some new infrastructure. When is the best time to run terraform validate?
What type of information can be found on the Terraform Registry when using published modules?
terraform apply is failing with the following error. What next step should you take to determine the root cause of the problem?
Error:
yaml
CopyEdit
Error loading state: AccessDenied: Access Denied
status code: 403, request id: 288766CE5CCA24A0, host id: web.example.com
You ate creating a Terraform configuration which needs to make use of multiple providers, one for AWS and one for Datadog. Which of the following provider blocks would allow you to do this?
A)

B)
C)
D)
If you don’t use the local Terraform backend, where else can Terraform save resource state?
A resource block is shown in the Exhibit space of this page. What is the Terraform resource name of that resource block?
Once you configure a new Terraform backend with a terraform code block, which command(s) should you use to migrate the state file?
Before you can use a new backend or HCP Terraform/Terraform Cloud integration, you must first execute terraform init.
Terraform can only manage resource dependencies if you set them explicitly with the depends_on argument.
How does the Terraform cloud integration differ from other state backends such as S3, Consul,etc?
You’ve just finished refactoring part of your Terraform workspace’s configuration to use a module to manage some of your resources. When you plan your changes, you notice that Terraform will destroy and recreate the affected resources. Doing so could cause unintended downtime in the application your workspace manages. What supported approach should you take to complete the refactor without destroying and recreating your resources?
When you include a module block in your configuration that references a module from the Terraform Registry, the " version " attribute is required.
Which command(s) adds existing resources in a public cloud into Terraform state?
When you initialize Terraform, where does it cache modules from the public Terraform Registry?
When declaring a variable, setting the sensitive argument to true will prevent the value from being stored in the state file.
You ' ve used Terraform to deploy a virtual machine and a database. You want to replace this virtual machine instance with an identical one without affecting the database. What is the best way to achieve this using Terraform?
What functionality do providers offer in Terraform? (Pick the 3 correct responses below.)