




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An overview of terraform, a popular infrastructure as code (iac) tool. It covers key concepts and workflows related to terraform, such as the remote backend, provisioning new infrastructure, managing state, and working with terraform providers and modules. The document also addresses common terraform commands, best practices, and security considerations. This information would be useful for university students, particularly those studying cloud computing, devops, or software engineering, to understand the role of terraform in modern infrastructure management and deployment.
Typology: Exams
1 / 8
This page cannot be seen from the preview
Don't miss anything!





The terraform.tfstate file always matches your currently built infrastructure. - B. False One remote backend configuration always maps to a single remote workspace. - False How is the Terraform remote backend different than other state backends such as S3, Consul, etc.? - A. It can execute Terraform runs on dedicated infrastructure on premises or in Terraform Cloud What is the workflow for deploying new infrastructure with Terraform? - C. Write a Terraform configuration, run terraform init, run terraform plan to view planned infrastructure changes, and terraform apply to create new infrastructure. A provider configuration block is required in every Terraform configuration. - B. False You run a local-exec provisioner in a null resource called null_resource.run_script and realize that you need to rerun the script.Which of the following commands would you use first? - A. terraform taint null_resource.run_script Which provisioner invokes a process on the resource created by Terraform? - A. remote-exec Which of the following is not true of Terraform providers? - C. None of the above What command does Terraform require the first time you run it within a configuration directory? - B. terraform init 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? - C. Run terraform state list to find the name of the resource, then terraform state show to find the attributes including public IP address Which of the following is not a key principle of infrastructure as code? - B. Golden images Terraform variables and outputs that set the "description" argument will store that description in the state file. - B. False Most Voted What is the provider for this fictitious resource? - A. vpc
If you manually destroy infrastructure, what is the best practice reflecting this change in Terraform? - A. Run terraform refresh What is not processed when running a terraform refresh? - B. Configuration file What information does the public Terraform Module Registry automatically expose about published modules? - D. All of the above If a module uses a local values, you can expose that value with a terraform output. - A. True You should store secret data in the same version control repository as your Terraform configuration. - B. False Which of the following is not a valid string function in Terraform? - D. chomp You have provisioned some virtual machines (VMs) on Google Cloud Platform (GCP) using the gcloud command line tool. However, you are standardizing withTerraform and want to manage these VMs using Terraform instead.What are the two things you must do to achieve this? (Choose two.) - B. Use the terraform import command for the existing VMs C. Write Terraform configuration for the existing VMs You have recently started a new job at a retailer as an engineer. As part of this new role, you have been tasked with evaluating multiple outages that occurred during peak shopping time during the holiday season. Your investigation found that the team is manually deploying new compute instances and configuring each compute instance manually. This has led to inconsistent configuration between each compute instance.How would you solve this using infrastructure as code? - D. Implement a provisioning pipeline that deploys infrastructure configurations committed to your version control system following code reviews terraform init initializes a sample main.tf file in the current directory. - B. False Which two steps are required to provision new infrastructure in the Terraform workflow? (Choose two.) - B. Apply D. Init Why would you use the terraform taint command? - B. When you want to force Terraform to destroy and recreate a resource on the next apply Terraform requires the Go runtime as a prerequisite for installation. - B. False When should you use the force-unlock command? - C. Automatic unlocking failed Terraform can import modules from a number of sources `" which of the following is not a valid source? - A. FTP server
When using a module block to reference a module stored on the public Terraform Module Registry such as: How do you specify version 1.0.0? - C. Add version = "1.0.0" attribute to module block What features does the hosted service Terraform Cloud provide? (Choose two.) - C. Remote state storage D. A web-based user interface (UI) Where does the Terraform local backend store its state? - C. In the terraform.tfstate file Which option can not be used to keep secrets out of Terraform configuration files? - D. secure string What is one disadvantage of using dynamic blocks in Terraform? - C. They make configuration harder to read and understand Only the user that generated a plan may apply it. - B. False Examine the following Terraform configuration, which uses the data source for an AWS AMI.What value should you enter for the ami argument in the AWS instance resource? - C. data.aws_ami.ubuntu.id FILL BLANK - You need to specify a dependency manually.What resource meta-parameter can you use to make sure Terraform respects the dependency?Type your answer in the field provided. The text field is not case-sensitive and all variations of the correct answer are accepted. - depends_on 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 contains15 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? - B. The Terraform state file only contains the one new VM. Execute terraform destroy. What is the name assigned by Terraform to reference this resource? - A. dev Setting the TF_LOG environment variable to DEBUG causes debug messages to be logged into syslog. - B. False Where in your Terraform configuration do you specify a state backend? - A. The terraform block In Terraform 0.13 and above, outside of the required_providers block, Terraform configurations always refer to providers by their local names. - A. True
What command should you run to display all workspaces for the current configuration? - C. terraform workspace list Terraform providers are always installed from the Internet. - B. False Which of these is the best practice to protect sensitive values in state files? - C. Enhanced remote backends When does terraform apply reflect changes in the cloud environment? - B. However long it takes the resource provider to fulfill the request How would you reference the "name" value of the second instance of this fictitious resource? - B. aws_instance.web[1].name A Terraform provider is not responsible for: - B. Provisioning infrastructure in multiple clouds Terraform provisioners can be added to any resource block. - A. True What is terraform refresh intended to detect? - C. State file drift FILL BLANK - Which flag would you add to terraform plan to save the execution plan to a file?Type your answer in the field provided. The text field is not case-sensitive and all variations of the correct answer are accepted. - - out=FILENAME FILL BLANK - 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. - Terraform.tfstate A Terraform local value can reference other Terraform local values. - A. True Which of the following is not a valid Terraform collection type? - C. tree When running the command terraform taint against a managed resource you want to force recreation upon, Terraform will immediately destroy and recreate the resource. - B. False All standard backend types support state storage, locking, and remote operations like plan, apply and destroy. - B. False How can terraform plan aid in the development process? - A. Validates your expectations against the execution plan without permanently modifying state You would like to reuse the same Terraform configuration for your development and production environments with a different state file for each.Which command would you use? - B. terraform workspace
A fellow developer on your team is asking for some help in refactoring their Terraform code. As part of their application's architecture, they are going to tear down an existing deployment managed by Terraform and deploy new. However, there is a server resource named aws_instance.ubuntu[1] they would like to keep to perform some additional analysis.What command should be used to tell Terraform to no longer manage the resource? - B. terraform state rm aws_instance.ubuntu[1] Terraform can only manage resource dependencies if you set them explicitly with the depends_on argument. - B. False A terraform apply can not _________ infrastructure. - D. import You need to constrain the GitHub provider to version 2.1 or greater.Which of the following should you put into the Terraform 0.12 configuration's provider block? - D. version = ג€= 2.1ג€ You just scaled your VM infrastructure and realized you set the count variable to the wrong value. You correct the value and save your change.What do you do next to make your infrastructure match your configuration? - A. Run an apply and confirm the planned changes Terraform provisioners that require authentication can use the ______ block. - A. connection Terraform validate reports syntax check errors from which of the following scenarios? - D. None of the above Most Voted Which of the following is allowed as a Terraform variable name? - B. name What type of block is used to construct a collection of nested configuration blocks? - D. dynamic Module variable assignments are inherited from the parent module and do not need to be explicitly set. - B. False If writing Terraform code that adheres to the Terraform style conventions, how would you properly indent each nesting level compared to the one above it? - D. With two spaces Which of the following is not an action performed by terraform init? - A. Create a sample main.tf file HashiCorp Configuration Language (HCL) supports user-defined functions. - B. False How can you trigger a run in a Terraform Cloud workspace that is connected to a Version Control System (VCS) repository? - B. Commit a change to the VCS working directory and branch that the Terraform Cloud workspace is connected to
Terraform and Terraform providers must use the same major version number in a single configuration. - B. False Which statement describes a goal of infrastructure as code? - D. The programmatic configuration of resources When using Terraform to deploy resources into Azure, which scenarios are true regarding state files? (Choose two.) - B. When a change is made to the resources via the Azure Cloud Console, Terraform will update the state file to reflect them during the next plan or apply C. When a change is made to the resources via the Azure Cloud Console, the current state file will not be updated You need to deploy resources into two different cloud regions in the same Terraform configuration. To do that, you declare multiple provider configurations as follows: What meta-argument do you need to configure in a resource block to deploy the resource to the us-west-2 AWS region? - C. provider = aws.west Most Voted You have declared an input variable called environment in your parent module. What must you do to pass the value to a child module in the configuration? - C. Declare a node_count input variable for child module