You have never used Terraform before and would like to test it out using a shared team account for a cloud provider. The shared team account already contains 15 virtual machines (VM). You develop a Terraform configuration containing one VM. perform terraform apply, and see that your VM was created successfully. What should you do to delete the newly-created VM with Terraform?
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 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?
Which of the following does terraform apply change after you approve the execution plan? (Choose two.)
Which argument can you set on a module block to prevent Terraform from updating the module’s configuration during an init or get operation?
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?
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 are some benefits of using Sentinel with Terraform Cloud/Terraform Cloud? Choose three correct answers.
All modules published on the official Terraform Module Registry have been verified by HasihCorp.
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?
You just upgraded the version of a provider in an existing Terraform project. What do you need to do to install the new provider?
You are updating a child module with the resource block shown in the exhibit below. The public_ip attribute of the resource needs to be accessible to the parent module.
Exhibit:
resource " aws_instance " " example " {
ami = " ami-0a123456789abcdef "
instance_type = " t3.micro "
}
How do you meet this requirement?
Which two steps are required to provision new infrastructure in the Terraform workflow? (Pick the 2 correct responses below.)
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?
When using multiple configuration of the same Terraform provider, what meta-argument must you include in any non-default provider configurations?
What is the Terraform style convention for indenting a nesting level compared to the one above it?
Which of these are benefits of using Sentinel with HCP Terraform/Terraform Cloud? (Pick the 3 correct responses)
Which of these are features of HCP Terraform/Terraform Cloud? Pick the 2 correct responses below.
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.
Infrastructure as Code (laC) can be stored in a version control system along with application code.
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?
You should run terraform fnt to rewrite all Terraform configurations within the current working directory to conform to Terraform-style conventions.
Your team uses HCP Terraform to manage infrastructure. You need to make a change to an infrastructure stack running in a public cloud. Which pattern follows Infrastructure as Code best practices for making the change?
A Terraform backend determines how Terraform loads state and stores updates when you execute which command?
You ate making changes to existing Terraform code to add some new infrastructure. When is the best time to run terraform validate?
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 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?
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?
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?
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?
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 ' 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?
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 Terraform output that sets the " sensitive " argument to true will not store that value in the state file.
You are tasked with making a change to an infrastructure stack running in a public cloud using HCP Terraform/Terraform Cloud. Which pattern follows IaC best practices?
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?
Which of the following methods, used to provision resources into a public cloud, demonstrates the concept of infrastructure as code?
Terraform stores the value of an output in its state file, even if the sensitive argument is set to true.
Which of the following locations can Terraform use as aprivate sourcefor modules?(Pick 2 correct responses)
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?
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?
Which of these statements about HCP Terraform/Terraform Cloud workspaces is false?
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 of the following command would be use to access all of the attributes and details of a resource managed by Terraform?
You have created a main.tf Terraform configuration consisting of an application server, a database and a load balanced. You ran terraform apply and Terraform created all of the resources successfully.
Now you realize that you do not actually need the load balancer, so you run terraform destroy without any flags. What will happen?
Which of these are features of HCP Terraform/Terraform Cloud? (Pick the 2 correct responses)
terraform validate confirms that your infrastructure matches the Terraform state file.
When you include a module block in your configuration that references a module from the Terraform Registry, the " version " attribute is required.
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 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?
Which are benefits of migrating from a local state backend to a remote backend? (Pick the 2 correct responses below.)
When should you write Terraform configuration files for existing infrastructure that you want to start managing with Terraform?
A resource block is shown in the Exhibit space of this page. What is the Terraform resource name of that resource block?
If you update the version constraint in your Terraform configuration, Terraform will update your lock file the next time you run terraform Init.
Which of these actions will prevent two Terraform runs from changing the same state file at the same time?
Which of the following can you do with terraform plan?
Pick the two correct responses below.
Exhibit:
data " vsphere_datacenter " " dc " {}
resource " vsphere_folder " " parent " {
path = " Production "
type = " vm "
datacenter_id = _________
}
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?
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?
You can access state stored with the local backend by using terraform_remote_state data source.
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?
Which command(s) adds existing resources in a public cloud into Terraform state?
You’ve updated your Terraform configuration, and you need to preview the proposed changes to your infrastructure. Which command should you run?
Your security team scanned some Terraform workspaces and found secrets stored in plaintext in state files. How can you protect that data?
What type of information can be found on the Terraform Registry when using published modules?
Your team adopts AWS CloudFormation as the standardized method for provisioning public cloud resources.
Which scenario presents a challenge for your team?