WorksheetsT6 # 276 - 332
Total questions: 55
Worksheet time: 55mins
Which of the below backends support state locking? three
S3
consul
azurerm
artifactory
Which of the following value will be accepted for my_var?
1. variable "my_var"
2. {
3. type = string
4. }
15
"15"
Both
None of the above
Select two answers to complete the following sentence: Before a new provider can be used, it must be ______ and _______.
approved by HashiCorp
uploaded to source control
declared in the configuration
initialized
Given the Terraform configuration below, in which order will the resources be created?
Larger image
resources will be created simultaneously
aws_eip will be created first aws_instance will be created second
aws_instance will be created first aws_eip will be created second
Explanation:
By default, where does Terraform store its state file?
Amazon S3 bucket
shared directory
remotely using Terraform Cloud
current working directory
What are some of the features of Terraform state? (select three)
inspection of cloud resources
determining the correct order to destroy resources
mapping configuration to real-world resources
increased performance
When configuring a remote backend in Terraform, it might be a good idea to purposely omit some of the required arguments to ensure secrets and other important data aren't inadvertently shared with others. What are the ways the remaining configuration can be added to Terraform so it can initialize and communicate with the backend? (select three)
directly querying HashiCorp Vault for the secrets
command-line key/value pairs
use the -backend-config=PATH to specify a separate config file
interactively on the command line
What Terraform command can be used to inspect the current state file?
terraform inspect
terraform read
terraform show
terraform state
Select the answer below that completes the following statement: Terraform Cloud can be managed from the CLI but requires __________?
an API token
a TOTP token
a username and password
authentication using MFA
What Terraform feature is shown in the example below?
conditional expression
local values
dynamic block
data source
HashiCorp offers multiple versions of Terraform, including Terraform open-source, Terraform Cloud, and Terraform Enterprise. Which of the following Terraform features are only available in the Enterprise edition? (select three)
SAML/SSO
Sentinel
Audit Logs
Private Module Registry
F. Private Network Connectivity
What are some of the problems of how infrastructure was traditionally managed before Infrastructure as Code? (select three)
Requests for infrastructure or hardware required a ticket, increasing the time required to deploy applications
Traditional deployment methods are not able to meet the demands of the modern business where resources tend to live days to weeks, rather than months to years
Traditionally managed infrastructure can't keep up with cyclic or elastic applications
Pointing and clicking in a management console is a scalable approach and reduces human error as businesses are moving to a multi-cloud deployment model
What is the best and easiest way for Terraform to read and write secrets from HashiCorp Vault?
Vault provider
API access using the AppRole auth method
integration with a tool like Jenkins
CLI access from the same machine running Terraform
True or False: Workspaces provide identical functionality in the open-source, Terraform Cloud, and Enterprise versions of Terraform.
True
False
True or False? terraform init cannot automatically download Community providers.
True
False
Which of the following terraform subcommands could be used to remove the lock on the state for the current configuration?
Unlock
force-unlock
Removing the lock on a state file is not possible
state-unlock
A user has created a module called "my_test_module" and committed it to GitHub. Over time, several commits have been made with updates to the module, each tagged in GitHub with an incremental version number. Which of the following lines would be required in a module configuration block in terraform to select tagged version v1.0.4?
source = "git::https://example.com/my_test_module.git@tag=v1.0.4"
source = "git::https://example.com/my_test_module.git&ref=v1.0.4"
source = "git::https://example.com/my_test_module.git#tag=v1.0.4"
source = "git::https://example.com/my_test_module.git?ref=v1.0.4"
In the example below, the depends_on argument creates what type of dependency?
implicit dependency
internal dependency
explicit dependency
non-dependency resource
What is the result of the following terraform function call?
True
False
While Terraform is generally written using the HashiCorp Configuration Language (HCL), what other syntax can Terraform are expressed in?
JSON
YAML
TypeScript
XML
Select the operating systems which are supported for a clustered Terraform Enterprise: (select four)
Unix
Red Hat
CentOS
Amazon Linux
Ubuntu
In order to reduce the time it takes to provision resources, Terraform uses parallelism. By default, how many resources will Terraform provision concurrently?
5
50
10
20
Provider dependencies are created in several different ways. Select the valid provider dependencies from the following list: (select three)
Explicit use of a provider block in configuration, optionally including a version constraint.
Use of any resource belonging to a particular provider in a resource or data block in configuration.
Existence of any resource instance belonging to a particular provider in the current state.
Existence of any provider plugins found locally in the working directory.
The following is a snippet from a Terraform configuration file: Which, when validated, results in the following error: Fill in the blank in the error message with the correct string from the list below.
version
multi
label
alias
True or False. The terraform refresh command is used to reconcile the state Terraform knows about (via its state file) with the real-world infrastructure. If drift is detected between the real-world infrastructure and the last known-state, it will modify the infrastructure to correct the drift.
True
False
True or False? Each Terraform workspace uses its own state file to manage the infrastructure associated with that particular workspace.
True
False
True or False? By default, Terraform destroy will prompt for confirmation before proceeding.
True
False
Select the most accurate statement to describe the Terraform language from the following list.
Terraform is an immutable, declarative, Infrastructure as Code provisioning language based on Hashicorp Configuration Language, or optionally JSON.
Terraform is a mutable, declarative, Infrastructure as Code configuration management language based on Hashicorp Configuration Language, or optionally JSON.
Terraform is an immutable, procedural, Infrastructure as Code configuration management language based on Hashicorp Configuration Language, or optionally JSON.
Terraform is a mutable, procedural, Infrastructure as Code provisioning language based on Hashicorp Configuration Language, or optionally YAML.
A user creates three workspaces from the command line - prod, dev, and test. Which of the following commands will the user run to switch to the dev workspace?
terraform workspace dev
terraform workspace select dev
terraform workspace -switch dev
terraform workspace switch dev
Select all Operating Systems that Terraform is available for. (select five)
Linux
macOS
Solaris
Windows
FreeBSD
Which of the following commands will launch the Interactive console for Terraform interpolations?
terraform console
terraform cli
terraform
terraform cmdline
During a terraform plan, a resource is successfully created but eventually fails during provisioning. What happens to the resource?
Terraform attempts to provision the resource up to three times before exiting with an error
the terraform plan is rolled back and all provisioned resources are removed
it is automatically deleted
the resource is marked as tainted
Which of the following is not a valid Terraform string function?
replace
format
join
tostring
Which of the following statements best describes the Terraform list(...) type?
a collection of values where each is identified by a string label.
a sequence of values identified by consecutive whole numbers starting with zero.
a collection of unique values that do not have any secondary identifiers or ordering.
a collection of named attributes that each have their own type.
True or False? When using the Terraform provider for Vault, the tight integration between these HashiCorp tools provides the ability to mask secrets in the terraform plan and state files.
True
False
Why might a user opt to include the following snippet in their configuration file?
Terraform 0.12 introduced substantial changes to the syntax used to write Terraform configuration
The user wants to ensure that the application being deployed is a minimum version of 0.12
this ensures that all Terraform providers are above a certain version to match the application being deployed
versions before Terraform 0.12 were not approved by HashiCorp to be used in production
Anyone can publish and share modules on the Terraform Public Module Registry, and meeting the requirements for publishing a module is extremely easy. Select from the following list all valid requirements. (select three)
The module must be PCI/HIPPA compliant.
Module repositories must use this three-part name format, terraform--
The registry uses tags to identify module versions
Release tag names must be for the format x.y.z, and can optionally be prefixed with a v
The module must be on GitHub and must be a public repo.
A user runs terraform init on their RHEL based server and per the output, two provider plugins are downloaded: $ terraform init Initializing the backend... Initializing provider plugins...
- Checking for available provider plugins...
- Downloading plugin for provider "aws" (hashicorp/aws) 2.44.0...
- Downloading plugin for provider "random" (hashicorp/random) 2.2.1...
:
Terraform has been successfully initialized!
Where are these plugins downloaded to?
The .terraform.plugins directory in the directory terraform init was executed in.
The .terraform/plugins directory in the directory terraform init was executed in.
/etc/terraform/plugins
The .terraform.d directory in the directory terraform init was executed in.
Which of the following is an invalid variable name?
count
web
var1
instance_name
In the following code snippet, the block type is identified by which string?
"aws_instance"
resource
db
instance_type
Which statements best describes what the local variable assignment is doing in the following code snippet:
Create a distinct list of route table name objects
Create a map of route table names to subnet names
Create a map of route table names from a list of subnet names
Create a list of route table names eliminating duplicates
What is the result of the following terraform function call?
lookup({a="hello", b="goodbye"}, "c", "what?")
hello
what?
goodbye
c
In terraform, most resource dependencies are handled automatically. Which of the following statements describes best how terraform resource dependencies are handled?
Resource dependencies are identified and maintained in a file called resource.dependencies. Each terraform provider is required to maintain a list of all resource dependencies for the provider and it's included with the plugin during initialization when terraform init is executed. The file is located in the terraform.d folder.
The terraform binary contains a built-in reference map of all defined Terraform resource dependencies. Updates to this dependency map are reflected in terraform versions. To ensure you are working with the latest resource dependency map you much be running the latest version of Terraform.
Resource dependencies are handled automatically by the depends_on meta_argument, which is set to true by default.
Terraform analyses any expressions within a resource block to find references to other objects, and treats those references as implicit ordering requirements when creating, updating, or destroying resources.
From the code below, identify the implicit dependency:
The EIP with an id of ami-2757f631
The AMI used for the EC2 instance
The EC2 instance labeled web_server
The S3 bucket labeled company_data
Terraform Cloud is more powerful when you integrate it with your version control system (VCS) provider. Select all the supported VCS providers from the answers below. (select four)
GitHub
CVS Version Control
Azure DevOps Server
Bitbucket Cloud
GitHub Enterprise
Terraform Enterprise (also referred to as pTFE) requires what type of backend database for a clustered deployment?
PostgreSQL
Cassandra
MySQL
MSSQL
When Terraform needs to be installed in a location where it does not have internet access to download the installer and upgrades, the installation is generally known as to be __________.
a private install
disconnected
air-gapped
non-traditional
When using providers that require the retrieval of data, such as the HashiCorp Vault provider, in what phase does Terraform actually retrieve the data required?
terraform delete
terraform plan
terraform init
terraform apply
What feature of Terraform Cloud and/or Terraform Enterprise can you publish and maintain a set of custom modules which can be used within your organization?
Terraform registry
custom VCS integration
private module registry
remote runs
Where can Terraform not load a provider from?
Plugins directory
Provider plugin cache
Official HashrCorp distribution on releases, hashicorp.com
Source code
Which argument(s) are required when declaring a Terraform variable?
type
default
description
All of the above
None of the above
terraform apply will fail if you have not run terraform plan first to update the plan output.
True
False
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?
Local values
Dynamic blocks
Count arguments
Collection functions
Which of the following is not a benefit of adopting infrastructure as code?
Automation
Versioning
Reusability of code
Interpolation
Which of the following statements about local modules is incorrect:
Local modules are not cached by terraform init command
Local modules are sourced from a directory on disk
Local modules support versions
All of the above (all statements above are incorrect
None of the above (all statements above are correct)
