If a module declares a variable with a default, that variable must also be defined within the module.
If you manually destroy infrastructure, what is the best practice reflecting this change in Terraform?
Which command should you run to check if all code in a Terraform configuration that references multiple modules is properly formatted without making changes?
Exhibit:
module " web_stack " {
source = " ./modules/web_stack "
}
Your configuration defines the module block shown in the exhibit. The web_stack module accepts an input variable named servers. Which of the following changes to the module block sets the servers variable to the value of 3?
Your team adopts AWS CloudFormation as the standardized method for provisioning public cloud resources.
Which scenario presents a challenge for your team?
A resource block is shown in the Exhibit section of this page. How would you reference the attribute name of this resource in HCL?
Which features do HCP Terraform workspaces provide that are not available in Terraform Community Edition? (Pick the 3 correct responses below.)
Which of the following locations can Terraform use as aprivate sourcefor modules?(Pick 2 correct responses)
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?
Part of a configuration is shown in the exhibit below.
You want to pass the id of the vsphere_datacenter data source to the datacenter_id argument of the vsphere_folder resource.
Which reference would you use?
Which option does not keep secret variable values out of Terraform configuration files?
You need to destroy all of the resources in your Terraform workspace, except for aws_instance.ubuntu[1], which you want to keep. How can you tell Terraform to stop managing that specific resource without destroying it?
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 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?
Which parameters does the import block require? (Pick the 2 correct responses below.)
What type of block is used to construct a collection of nested configuration blocks?
In a Terraform Cloud workpace linked to a version control repository speculative plan rum start automatically commit changes to version control.
You have a list of numbers representing the number of free CPU cores on each virtual cluster:
numcpus = [18, 3, 7, 11, 2]
Which Terraform built-in function would you use to select the largest number from the list?
Which provider authentication method prevents credentials from being stored in the state file?
You can execute terraform fmt to standardize all Terraform configurations within the current working directory to Terraform’s canonical format and style.
As a member of an operations team that uses infrastructure as code (lac) practices, you are tasked with making a change to an infrastructure stack running in a public cloud. Which pattern would follow laC best practices for making a change?
You manage two workspaces in your HCP Terraform organization. The first workspace manages your network configuration. The second workspace manages your compute resources and retrieves values from the networking workspace.
What HCP Terraform feature lets you run an apply operation on the compute workspace every time you update the networking workspace?
Where does HashiCorp recommend you store API tokens and other secrets within your team ' s Terraform workspaces?
Pick three correct responses below:
Which of these are features of HCP Terraform/Terraform Cloud? (Pick the 2 correct responses)
You have a simple Terraform configuration containing one virtual machine (VM) in a cloud provider. You run terraform apply and the VM is created successfully.
What will happen if you delete the VM using the cloud provider console, then run terraform apply again without changing any Terraform code?
A Terraform configuration returns errors when you run terraform plan. How would you enable debug logging to investigate further?
Which of these actions are forbidden when the Terraform state file is locked? (Pick the 3 correct responses)
How can a ticket-based system slow down infrastructure provisioning and limit the ability to scale? Choose two correct answers.
Exhibit.
You need to deploy resources into two different regions in the same Terraform configuration. To do this, you declare multiple provider configurations as shown in the Exhibit space on this page.
What meta-argument do you need to configure in a resource block to deploy the resource to the us-west-2 AWS region?
What does Terraform not reference when running a terraform apply -refresh-only ?
What Terraform command always causes a state file to be updated with changes that might have been made outside of Terraform?
Infrastructure as Code (laC) can be stored in a version control system along with application code.
Which of the following can you do with terraform plan? (Pick 2 correct responses)
Which are benefits of migrating from a local state backend to a remote backend? (Pick the 2 correct responses below.)
The -refresh-only parameter will update your state file when used with terraform plan.
Exhibit:
data " aws_ami " " web " {
most_recent = true
owners = [ " self " ]
tags = {
Name = " web-server "
}
}
A data source is shown in the exhibit. How do you reference the id attribute of this data source?
A senior admin accidentally deleted some of your cloud instances. What will Terraform do when you run terraform apply?
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?
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?
How would you output returned values from a child module in the Terraform CLI output?
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?
Multiple team members are collaborating on infrastructure using Terraform and want to format the* Terraform code following standard Terraform-style convention.
How should they ensure the code satisfies conventions?
Your Terraform configuration manages a resource that requires maximum uptime. You need to update the resource, and when you run terraform plan, Terraform indicates that the update requires the resource to be destroyed and recreated.
Which lifecycle rule can you add to the resource to reduce downtime while still applying the update?
You created infrastructure outside the Terraform workflow that you now want to manage using Terraform. Which command brings the infrastructure into Terraform state?
When you initialize Terraform, where does it cache modules from the public Terraform Registry?
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 ' 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?
Terraform configuration (including any module references) can contain only one Terraform provider type.
You have a simple Terraform configuration containing one VM (virtual machine) in a cloud provider. You run terraform apply and the VM is created successfully. What will happen if you run terraform apply again immediately afterwards without changing any Terraform code?
terraform validate confirms that your infrastructure matches the Terraform state file.
You have successfully deployed an application that includes a resource with a public IP address. Due to a configuration oversight, no outputs were defined.
Using the Terraform CLI, how can you find the IP address of the deployed resource with minimum disruption to the application?
Which of the following does HCP Terraform perform during a health assessment for a workspace?
Which command(s) adds existing resources in a public cloud into Terraform state?
How does the use of Infrastructure as Code (IaC) enhance the reliability of your infrastructure?
Pick the two correct responses below.
If you update the version constraint in your Terraform configuration, Terraform will update your lock file the next time you run terraform Init.
What is the Terraform style convention for indenting a nesting level compared to the one above it?
Which type of information does the Terraform Registry provide about the modules it hosts?
A Terraform output that sets the " sensitive " argument to true will not store that value in the state file.
A data source is shown in the exhibit below.
How do you reference the id attribute of this data source?
}
}
When using multiple configurations of the same Terraform provider, what meta-argument must you include in any non-default provider configurations?
Where in your Terraform configuration do you specify remote state storage settings?
As a developer, you want to ensure your plugins are up to date with the latest versions. Which Terraform command should you use?
What functionality do providers offer in Terraform? (Pick the 3 correct responses below.)
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?
You have a saved execution plan containing desired changes for infrastructure managed by Terraform. After running the command terraform apply my.tfplan, you receive the error shown in the exhibit 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.
How can you apply the desired changes? (Choose TWO correct answers)
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 using a remote backend or terraform Cloud integration, where does Terraform save resource sate?
Terraform stores the value of an output in its state file, even if the sensitive argument is set to true.
Which command must you first run before performing further Terraform operations in a working directory?
Which option cannot be used to keep secrets out of Terraform configuration files?