Outside of the required_providers block, Terraform configurations always refer to providers by their local names.
ATrue
BFalse
What is an advantage of immutable infrastructure?
AAutomatic infrastructure upgrades
BIn-place infrastructure upgrades
CQuicker infrastructure upgrades
DLess complex infrastructure upgrades
A child module can always access variables declared in its parent module.
ATrue
BFalse
Where does HashiCorp recommend you store API tokens and other secrets within your team’s Terraform workspaces? (Choose three.)
AIn a terraform.tfvars file, checked into your version control system.
BIn an environment variable and referenced with TF_VAR_variablename.
CIn HashiCorp Vault.
DIn a plaintext document on a shared drive.
EIn an HCP Terraform variable, with the sensitive option checked.
You are responsible for a set of infrastructure which 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? (Choose two.)
AA health check configured on the example-compute workspace to create a plan when HCP Terraform applies changes to the example-network workspace.
BA run trigger configured on the example-network workspace to automatically plan changes to the example-compute workspace after every apply.
CA health check configured on the example-network workspace to create a plan on the example-compute workspace when HCP Terraform applies changes to it.
DA run trigger configured on the example-compute workspace to automatically plan changes after HCP Terraform applies changes to the example-network workspace.
EA tfe_outputs data source configured in the example-compute workspace to automatically load output values from the example-network workspace.
Which HCP Terraform feature is recommended when you want to use the same cloud provider credentials across multiple workspaces?
AVariable sets
BVersion Control System (VCS) integration
CThe terraform_remote_state data source
You can configure multiple cloud blocks in your Terraform configuration to connect your workspace to both HCP Terraform and your Terraform Enterprise instance.
ATrue
BFalse
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?
AProjects
BPolicy
CRun tasks
DRun triggers
Which of the following does HCP Terraform perform during a health assessment for a workspace? (Choose two.)
ASentinel policy checks
BResource drift detection
CEstimate infrastructure cost
DCheck block validation
ETerraform test execution
Your team uses HCP Terraform to manage your 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 a change?
AMake the change via the public cloud API endpoint.
BUse the public cloud console to make the change.
CRun the public cloud CLI tool to make the change.
DSubmit a pull request and wait for an approved merge of the change.
EClone the repository containing your infrastructure code and then run the code.
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 VMs (virtual machines). You develop a new Terraform configuration containing one VM, perform terraform apply, and see that your VM was created successfully.
How do you delete the newly-created VM with Terraform?
ADelete the Terraform state file and execute terraform apply.
BThe Terraform state file only contains one new VM. Execute terraform destroy.
CThe Terraform state file contains all 16 VMs in the team account. Execute terraform destroy and select the newly-created VM.
DDelete the VM using the cloud provider console, and execute terraform apply to apply the changes to the Terraform state file.
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.
You delete the VM using the cloud provider console, then run terraform apply again without changing any Terraform code.
What happens next?
ATerraform will report an error.
BTerraform will recreate the VM.
CTerraform will remove the VM from the state file.
DTerraform will not make any changes.
What does terraform destroy do?
ADestroys all Terraform code files in the current directory, leaves the state file intact.
BDestroys all infrastructure in the Terraform state file.
CDestroys the Terraform state file, leaves the infrastructure intact.
DDestroys all infrastructure in the configured Terraform provider.
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?
AInspect your Terraform state because you want to change it.
BRun terraform apply and confirm the planned changes.
CInspect all Terraform outputs to make sure they are correct.
DReinitialize because your configuration has changed.
When a check block’s assertion fails, Terraform blocks the current operation from executing.
ATrue
BFalse
If you manually destroy resources within your infrastructure, what is the best practice for reflecting this change in Terraform?
ARun terraform import to reflect the changes in Terraform state.
BManually update the state file to remove the destroyed resources.
CRemove the resource definition from your file and run terraform apply -refresh-only.
DThe change will happen automatically during the next terraform apply.
You have a Terraform configuration that defines a single virtual machine with no references to it. You’ve run terraform apply to create the resource, then removed the resource definition from your Terraform configuration file.
What will happen when you run terraform apply in the working directory again?
ATerraform will error.
BNothing will happen.
CTerraform will remove the virtual machine from the state file, but the resource will still exist.
DTerraform will destroy the virtual machine.
A senior admin accidentally deleted some of your cloud instances.
What will Terraform do when you run terraform apply?
AStop and generate an error message about the missing instances.
BRebuild only the instances that were deleted.
CBuild a completely brand new set of infrastructure.
DTear down the entire workspace’s infrastructure and rebuild it.
terraform destroy is the only way to remove infrastructure with Terraform.
ATrue
BFalse
The -refresh-only parameter will update your state file when used with terraform plan.
ATrue
BFalse
What Terraform command always causes a state file to be updated with changes that might have been made outside of Terraform?
Aterraform plan -refresh-only
Bterraform show -json
Cterraform apply =lock=false
Dterraform plan -target=state
When should you use the force-unlock command?
AWhen you see a status message stating that you cannot acquire the lock.
BWhen apply has failed due to a state lock.
CWhen automatic unlocking has failed.
DWhen you have a high priority change.
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?
AAdd moved blocks to your configuration to let Terraform know the new resource addresses for the affected resources.
BOpen your cloud provider’s console and rename the effected resources.
CRun the terraform console command to edit your workspace’s state and update the resource names.
DManually edit your terraform.tfstate file and update the resource names.
What is the purpose of state locking in a remote backend?
AEnsures only one instance of Terraform can modify state at a time.
BCreates a backup of the state file in a secure location.
CEncrypts the state in the remote backend.
DRequires every instance of Terraform uses the same provider version.
You want to bring in an existing database under Terraform management.
What information is required to create a new import block for the database? (Choose two.)
AThe connection string that Terraform will use to connect and manage the database.
BThe ID associated with the current database on the cloud provider.
CThe database platform and version that is the existing resource is running.
DThe path to the .tf file that contains the database resource block.
EThe destination resource address of the block that will manage the database.