Which features do HCP Terraform workspaces provide that are not available in Terraform Community Edition? (Pick the 3 correct responses below.)
One remote backend configuration always maps to a single remote workspace.
terraform validate confirms that your infrastructure matches the Terraform state file.
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 statements are true about terraform apply? (Choose TWO correct answers)
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?
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?
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?
When you run terraform apply -refresh-only, which of the following is not consulted by Terraform to update the state file?
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 decide to move a Terraform state file to Amazon S3 from another location. You write the code below into a file called backend.tf.
Which command will migrate your current state file to the new S3 remote backend?
Which of these is true about Terraform ' s plugin-based architecture?
Which of the following commands would you use to access all of the attributes and details of a resource managed by Terraform?
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?
When you use a remote backend that needs authentication, HashiCorp recommends that you:
What is the provider for this resource?
Which of the following does HCP Terraform perform during a health assessment for a workspace?
When should you use the terraform force-unlock command?
What is one disadvantage of using dynamic blocks in Terraform?
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?
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 terraform apply again immediately afterward without changing any Terraform code?
Which method for sharing Terraform modules fulfills the following criteria:
Keeps the module configurations confidential within your organization.
Supports Terraform ' s semantic version constraints.
Provides a browsable directory of your modules.
What is a key benefit of the Terraform state file?
INcheck block ' s assertion fails, Terraform blocks the current operation from executing.
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 need to deploy resources into two different regions in the same Terraform configuration using the block shown in the exhibit below.
What do you need to add to the provider configuration to deploy the resource to the us-west-2 AWS region?
What is the purpose of the terraform.lock.hcl file in Terraform?
terraform validate confirms thesyntaxof Terraform files.
The Terraform configuration shown in the Exhibit space on this page v/ill create a new AWS instance.
Select the command that doesn’t cause Terraform to refresh its state.
A Terraform backend determines how Terraform loads state and stores updates when you execute which command?
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?
Which option cannot be used to keep secrets out of Terraform configuration files?
You corrected a typo in a resource name, changing it from aws_s3_bucket.photoes to aws_s3_bucket.photos. You want to update the Terraform state so that the existing resource is recognized under the new name, without destroying and recreating it. Which configuration should you use?
All standard backend types support state locking, and remote operations like plan, apply, and destroy.
terraform init retrieves and caches the configuration for all remote modules.
Running terraform fmt without any flags in a directory with Terraform configuration files will check the formatting of those files, but will never change their contents.
When using a remote backend or terraform Cloud integration, where does Terraform save resource sate?
Which of these actions will prevent two Terraform runs from changing the same state file at the same time?
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?
Which of the following arguments are required when declaring a Terraform output?
The HCP Terraform private registry keeps the module configurations confidential within your organization.
How does Terraform determine dependencies between resources?
What information does the public Terraform Module Registry automatically expose about published modules?
What is the workflow for deploying new infrastructure with Terraform?
Which are examples of infrastructure as code? Choose two correct answers.
What is modified when executing Terraform inrefresh-only mode?
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)
Which situation will return an error when you run terraform validate?
A resource block is shown in the Exhibit space of this page. What is the provider for this resource?
Which Terraform command checks that your configuration syntax is correct?
What task does the terraform import command perform?
Which of the following module source paths does not specify a remote module?
You can configure multiple cloud blocks in your Terraform configuration to connect your workspace to both HCP Terraform and your Terraform Enterprise instance.
terraform plan updates your state file.
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?
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?
Which of these workflows is only enabled by the use of Infrastructure as Code?
You’ve enabled DEBUG-level logging for Terraform, and you’d like to send the log data to a file. Which action should you take?
What is the Terraform style convention for indenting a nesting level compared to the one above it?
Using the terraform state rm command against a resource will destroy it.
terraform init creates an example main.tf file in the current directory.
Your security team scanned some Terraform workspaces and found secrets stored in plaintext in state files. How can you protect that data?
Where does HashiCorp recommend you store API tokens and other secrets within your team’s Terraform workspaces?
Pick the three correct responses below.
When using Terraform to deploy resources into Azure, which scenarios are true regarding state files? (Choose two.)
How would you output returned values from a child module in the Terraform CLI output?
If a module declares a variable with a default, that variable must also be defined within the module.
Which argument can you set on a module block to prevent Terraform from updating the module’s configuration during an init or get operation?
If a module declares a variable without a default value, you must pass the value of the variable within the module block when you call the module in your configuration.
_______backends support state locking.
What kind of configuration block will manage an infrastructure object with settings specified within the block?
Which of the following locations can Terraform use as aprivate sourcefor modules?(Pick 2 correct responses)
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?
How can terraform plan aid in the development process?
The public Terraform Module Registry is free to use.
Where in your Terraform configuration do you specify a state backend?
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 configuration (including any module references) can contain only one Terraform provider type.
Why would you use the -replace flag for terraform apply?
Variables declared within a module are accessible outside of the module.
Module version is required to reference a module on the Terraform Module Registry.
You can configure Terraform to log to a file using the TF_LOG environment variable.
You are responsible for a set of infrastructure that is managed by two workspaces: example-network and example-compute. The example-compute workspace uses data from output values configured in the example-network workspace and must be deployed afterward. Currently, this is a manual process:
An operator deploys changes to the example-network workspace.
They manually copy the output values from the example-network workspace to input variables configured for the example-compute workspace.
They deploy the example-compute workspace.
Which HCP Terraform features can you use to automate this process?
Pick the two correct responses below.
Which of the following does terraform apply change after you approve the execution plan? (Choose two.)
You have just developed a new Terraform configuration for two virtual machines with a cloud provider. You would like to create the infrastructure for the first time.
Which Terraform command should you runfirst?
Which is a benefit of using infrastructure as code (IaC) tools compared to native platform APIs?
What is the primary purpose of IaC (Infrastructure as Code)?
Running terraform fmt without any flags in a directory with Terraform configuration files check the formatting of those files without changing their contents.
Terraform configuration can only import modules from the public registry.
A provider configuration block is required in every Terraform configuration.
Example:
You want to define multiple data disks as nested blocks inside the resource block for a virtual machine. What Terraform feature would help you define the blocks using the values in a variable?
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)
Terraform stores the value of an output in its state file, even if the sensitive argument is set to true.
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?
Your team is using version 3.1.4 of a module from the public Terraform Registry, and they are worried about possible breaking changes in future versions of the module. Which version argument should you add to the module block to prevent newer versions from being used?
What feature stops multiple users from operating on the Terraform state at the same time?
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.
Which are forbidden actions when the terraform state file is locked? Choose three correct answers.
How does Terraform manage most dependencies between resources?
You’ve updated your Terraform configuration, and you need to preview the proposed changes to your infrastructure. Which command should you run?
Any user can publish modules to the public Terraform Module Registry.
Which of the following should you put into the required_providers block?
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 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?
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?