If one of your modules uses a local value, you can expose that value to callers of the module by defining a Terraform output in the module’s configuration.
Module variable assignments are inherited from the parent module and you do not need to explicitly set them.
If a module declares a variable with a default, that variable must also be defined within the module.
Does terraform init create an example main.tf file in the current directory?
Which is a benefit of using infrastructure as code (IaC) tools compared to native platform APIs?
If you don’t use the local Terraform backend, where else can Terraform save resource state?
In a HCP Terraform/Terraform Cloud workspace linked to a version control repository, speculative plan runs start automatically when you merge or commit changes to version control.
Which of the following does terraform apply change after you approve the execution plan? (Choose two.)
Your configuration contains a module block that references a module from the Terraform Registry and sets the version argument to 1.0. You just published a new version of the module and updated your configuration to point to version 1.1.
Which command must be run to install the new version?
Which type of information does the Terraform Registry provide about the modules it hosts?
Setting the TF_LOG environment variable to DEBUG causes debug messages to be logged into stdout.
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 must use different Terraform commands depending on the cloud provider you use.
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?
You want to create a string that is a combination of a generated random_id and a variable, and reuse that string several times in your configuration.
What is the simplest correct way to implement this without repeating the random_id and variable?
How could you reference an attribute from the vsphere_datacenter data source for use with the datacenter_id argument within the vsphere_folder resource in the following configuration?
A module block used in your configuration is shown in the exhibit. You have been asked to update the version of this module from 4.2.1 to 5.0.0.
Exhibit:
module " compute " {
source = " Azure/compute/azurerm "
version = " 4.2.1 "
}
Which two steps must you take to accomplish this?
After creating a new Terraform configuration, your configuration passes terraform validate but returns an “Access Denied” error from the cloud provider when running terraform plan.
Why did terraform validate not catch this issue?
If a DevOps team adopts AWS CloudFormation as their standardized method for provisioning public cloud resoruces, which of the following scenarios poses a challenge for this team?
Module version is required to reference a module on the Terraform Module Registry.
You want to bring an existing database under Terraform management. What information is required to create a new import block for the database?
Pick the 2 correct responses below:
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?
Exhibit:
variable " sizes " {
type = list(string)
description = " Valid server sizes "
default = [ " small " , " medium " , " large " ]
}
A variable declaration is shown in the exhibit. Which is the correct way to get the value of medium from this variable?
When you use a remote backend that needs authentication, HashiCorp recommends that you:
In Terraform HCL, an object type of object({name=string, age-number}) would match this value.

Exhibit:
resource " kubernetes_namespace " " example " {
name = " test "
}
A resource block is shown in the exhibit. How would you reference the name attribute of this resource in HCL?
Which option does not keep secret variable values out of Terraform configuration files?

The Terraform configuration shown in the Exhibit space on this page v/ill create a new AWS instance.
Which of the following isnotan advantage of using Infrastructure as Code (IaC) operations?
You have two separate Terraform configurations:
Configuration A provisions a virtual network and subnets.
Configuration B provisions compute resources that must be attached to those subnets.
In Configuration B, you have a terraform_remote_state data source configured to read Configuration A’s local state file. When running terraform plan for Configuration B in a CI/CD pipeline, Terraform fails because the state file cannot be found and is not accessible to the pipeline runtime.
What is the best solution to reliably access the state data from Configuration A in this scenario?
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 previously applied your Terraform configuration to create infrastructure in your cloud provider. Your configuration uses the local backend, and you accidentally deleted your terraform.tfstate file.
What does Terraform do the next time you run terraform apply?
A resource block is shown in the Exhibit space of this page. What is the Terraform resource name of that resource block?
What does this code do?
terraform { required_providers { aws = " > = 3.0 " }}
A developer launched a VM outside of the Terraform workflow and ended up with two servers with the same name. They are unsure which VM is managed with Terraform, but they do have a list of all active VM IDs. Which method could you use to determine which instance Terraform manages?
Which of the following commands would you use to access all of the attributes and details of a resource managed by Terraform?
How does the Terraform cloud integration differ from other state backends such as S3, Consul,etc?
Which features do HCP Terraform workspaces provide that are not available in Terraform Community Edition? (Pick the 3 correct responses below.)
You can develop a custom provider to manage its resources using Terraform.
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 command(s) adds existing resources in a public cloud into Terraform state?
You are creating a reusable Terraform configuration and want to include an optional billing_dept tag so your Finance team can track team-specific spending on resources. Which of the following billing_dept variable declarations will achieve this?
Which argument can you set on a module block to prevent Terraform from updating the module’s configuration during an init or get operation?
As a developer, you want to ensure your plugins are up to date with the latest versions. Which Terraform command should you use?
It is best practice to store secret data in the same version control repository as your Terraform configuration.
Which command must you run before you run a plan or apply for the first time?
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.
You created infrastructure outside the Terraform workflow that you now want to manage using Terraform. Which command brings the infrastructure into Terraform state?
You just upgraded the version of a provider in an existing Terraform project. What do you need to do to install the new provider?
Which of the following does HCP Terraform perform during a health assessment for a workspace?
Pick the 2 correct responses below:
Which provider authentication method prevents credentials from being stored in the state file?
Which of the following can you do with terraform plan?
Pick the two correct responses below.
You ' re writing a Terraform configuration that needs to read input from a local file called id_rsa.pub . Which built-in Terraform function can you use to import the file ' s contents as a string?
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?
terraform validate confirms that your infrastructure matches the Terraform state file.
You can reference a resource created with for_each using a Splat ( *) expression.
What functionality do providers offer in Terraform?(Pick 3 correct responses)
Which of these actions are forbidden when the Terraform state file is locked? (Pick the 3 correct responses)
What is the Terraform style convention for indenting a nesting level compared to the one above it?
When using multiple configurations of the same Terraform provider, what meta-argument must you include in any non-default provider configurations?
How does the use of Infrastructure as Code (IaC) enhance the reliability of your infrastructure?
Pick the two correct responses below.
Exhibit:
Error: Saved plan is stale
The given plan file can no longer be applied because the state was changed by another operation after the plan was created.
You have a saved execution plan containing desired changes for infrastructure managed by Terraform. After running terraform apply my.tfplan, you receive the error shown. How can you apply the desired changes? (Pick the 2 correct responses below.)
You need to determine from which paths Terraform is loading the providers referenced in your *.tf files.
How can you enable additional logging to see this information?
A senior admin accidentally deleted some of your cloud instances. What will Terraform do when you run terraform apply?
What information does the public Terraform Module Registry automatically expose about published modules?
Which argument can you use toprevent unexpected updatesto a module ' s configuration when calling Terraform Registry modules?
Which of the following arguments are required when declaring a Terraform output?
It is __________ to change the Terraform backend from the default local backend to a different backend after performing your first terraform apply.
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
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?
If you update the version constraint in your Terraform configuration, Terraform will update your lock file the next time you run terraform Init.
You just scaled your VM infrastructure and realize you set the count variable to the wrong value. You correct the value and save your change. What must you do next to make your infrastructure match your configuration?
Which of the following should you add in the required_providers block to define a provider version constraint?
INcheck block ' s assertion fails, Terraform blocks the current operation from executing.
Terraform configuration can only import modules from the public registry.
Terraform requires using a different provider for each cloud provider where you want to deploy resources.
What command can you run to generateDOT (Graphviz)formatted data to visualize Terraform dependencies?
Which of the following does HCP Terraform perform during a health assessment for a workspace?
Your team adopts AWS CloudFormation as the standardized method for provisioning public cloud resources. Which scenario presents a challenge for your team?
You can define multiple backend blocks in your Terraform configuration to store your state in multiple locations.
One remote backend configuration always maps to a single remote workspace.
Exhibit:
Root module configuration:
output " vnet_id " {
value = module.my_network.vnet_id
}
Error:
Error: Reference to undeclared output value
on main.tf line 12, in output " vnet_id " :
12: value = module.my_network.vnet_id
You are using a networking module in your Terraform configuration with the name my_network. Your root module includes the configuration shown. When you run terraform validate, you get the error shown. Which option would successfully retrieve this value from your networking module?