wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

T2 # 56-110

Total questions: 55

Worksheet time: 55mins

Name
Class
Date
1.

When does terraform apply reflect changes in the cloud environment?

a)

Immediately

b)

However long it takes the resource provider to fulfill the request

c)

After updating the state file

d)

Based on the value provided to the -refresh command line argument

e)

None of the above

2.

How would you reference the "name" value of the second instance of this fictitious resource?

a)

element(aws_instance.web, 2)

b)

aws_instance.web[1].name

c)

aws_instance.web[1]

d)

aws_instance.web[2].name

e)

aws_instance.web.*.name

3.

A Terraform provider is not responsible for:

a)

Understanding API interactions with some service

b)

Provisioning infrastructure in multiple clouds

c)

Exposing resources and data sources based on an API

d)

Managing actions to take based on resource differences

4.

Terraform provisioners can be added to any resource block.

a)

True

b)

False

5.

What is terraform refresh intended to detect?

a)

Terraform configuration code changes

b)

Empty state files

c)

State file drift

d)

Corrupt state files

6.

Which flag would you add to terraform plan to save the execution plan to a file?

(a)  

7.

What is the name of the default file where Terraform stores the state?

(a)  

8.

A Terraform local value can reference other Terraform local values.

a)

True

b)

False

9.

Which of the following is not a valid Terraform collection type?

a)

list

b)

map

c)

tree

d)

set

10.

When running the command terraform taint against a managed resource you want to force recreation upon, Terraform will immediately destroy and recreate the resource.

a)

True

b)

False

11.

All standard backend types support state storage, locking, and remote operations like plan. apply and destroy.

a)

True

b)

False

12.

How can terraform plan aid in the development process?

a)

Validates your expectations against the execution plan without permanently modifying state

b)

Initializes your working directory containing your Terraform configuration files

c)

Formats your Terraform configuration files

d)

Reconciles Terraform’s state against deployed resources and permanently modifies state using the current status of deployed resources

13.

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?

a)

terraform import

b)

terraform workspace

c)

terraform state

d)

terraform init

14.

What is the name assigned by Terraform to reference this resource?

a)

compute_instance

b)

main

c)

google

d)

test

15.

You’re building a CI/CD (continuous integration/ continuous delivery) pipeline and need to inject sensitive variables into your Terraform run. How can you do this safely?

a)

Pass variables to Terraform with a –var flag

b)

Copy the sensitive variables into your Terraform code

c)

Store the sensitive variables in a secure_vars.tf file

d)

Store the sensitive variables as plain text in a source code repository

16.

Your security team scanned some Terraform workspaces and found secrets stored in a plaintext in state files. How can you protect sensitive data stored in Terraform state files?

a)

Delete the state file every time you run Terraform

b)

Store the state in an encrypted backend

c)

Edit your state file to scrub out the sensitive data

d)

Always store your secrets in a secrets.tfvars file

17.

In contrast to Terraform Open Source, when working with Terraform Enterprise and Cloud Workspaces, conceptually you could think about them as completely separate working directories.

a)

True

b)

False

18.

You want to know from which paths Terraform is loading providers referenced in your Terraform configuration (files). You need to enable debug messages to find this out. Which of the following would achieve this?

a)

Set the environment variable TF_LOG=TRACE

b)

Set verbose logging for each provider in your Terraform configuration

c)

Set the environment variable TF_VAR_log=TRACE

d)

Set the environment variable TF_LOG_PATH

19.

How is terraform import run?

a)

As a part of terraform init

b)

As a part of terraform plan

c)

As a part of terraform refresh

d)

By an explicit call

e)

All of the above

20.

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, and run terraform apply again without changing any Terraform code?

a)

Terraform will remove the VM from state file

b)

Terraform will report an error

c)

Terraform will not make any changes

d)

Terraform will recreate the VM

21.

Which of these options is the most secure place to store secrets for connecting to a Terraform remote backend?

a)

Defined in Environment variables

b)

Inside the backend block within the Terraform configuration

c)

Defined in a connection configuration outside of Terraform

d)

None of above

22.

Your DevOps team is currently using the local backend for your Terraform configuration. You would like to move to a remote backend to begin storing the state file in a central location. Which of the following backends would not work?

a)

Amazon S3

b)

Artifactory

c)

Git

d)

Terraform Cloud

23.

Which backend does the Terraform CLI use by default?

a)

Terraform Cloud

b)

Consul

c)

Remote

d)

Local

24.

When you initialize Terraform, where does it cache modules from the public Terraform Module Registry?

a)

On disk in the /tmp directory

b)

In memory

c)

On disk in the .terraform sub-directory

d)

They are not cached

25.

You write a new Terraform configuration and immediately run terraform apply in the CLI using the local backend. Why will the apply fail?

a)

Terraform needs you to format your code according to best practices first

b)

Terraform needs to install the necessary plugins first

c)

The Terraform CLI needs you to log into Terraform cloud first

d)

Terraform requires you to manually run terraform plan first

26.

What features stops multiple admins from changing the Terraform state at the same time?

a)

Version control

b)

Backend types

c)

Provider constraints

d)

State locking

27.

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?

a)

terraform apply rm aws_instance.ubuntu[1]

b)

terraform state rm aws_instance.ubuntu[1]

c)

terraform plan rm aws_instance.ubuntu[1]

d)

terraform delete aws_instance.ubuntu[1]

28.

Terraform can only manage resource dependencies if you set them explicitly with the depends_on argument.

a)

True

b)

False

29.

A terraform apply can not _________ infrastructure.

a)

change

b)

destroy

c)

provision

d)

import

30.

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?

a)

version >= 2.1

b)

version ~> 2.1

c)

version = “<= 2.1”

d)

version = “>= 2.1”

31.

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

b)

Inspect your Terraform state because you want to change it

c)

Reinitialize because your configuration has changed

d)

Inspect all Terraform outputs to make sure they are correct

32.

Terraform provisioners that require authentication can use the ______ block.

a)

connection

b)

credentials

c)

secrets

d)

ssh

33.

Terraform validate reports syntax check errors from which of the following scenarios?

a)

Code contains tabs indentation instead of spaces

b)

There is missing value for a variable

c)

The state files does not match the current infrastructure

d)

None of the above

34.

Which of the following is allowed as a Terraform variable name?

a)

count

b)

name

c)

source

d)

version

35.

What type of block is used to construct a collection of nested configuration blocks?

a)

for_each

b)

repeated

c)

nesting

d)

dynamic

36.

Module variable assignments are inherited from the parent module and do not need to be explicitly set.

a)

True

b)

False

37.

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?

a)

With four spaces

b)

With a tab

c)

With three spaces

d)

With two spaces

38.

Which of the following is not an action performed by terraform init?

a)

Create a sample main.tf file

b)

Initialize a configured backend

c)

Retrieve the source code for all referenced modules

d)

Load required provider plugins

39.

How can you trigger a run in a Terraform Cloud workspace that is connected to a Version Control System (VCS) repository?

a)

Only Terraform Cloud organization owners can set workspace variables on VCS connected workspaces

b)

Commit a change to the VCS working directory and branch that the Terraform Cloud workspace is connected to

c)

Only members of a VCS organization can open a pull request against repositories that are connected to Terraform Cloud workspaces

d)

Only Terraform Cloud organization owners can approve plans in VCS connected workspaces

40.

Terraform and Terraform providers must use the same major version number in a single configuration.

a)

True

b)

False

41.

Which statement describes a goal of infrastructure as code?

a)

An abstraction from vendor specific APIs

b)

Write once, run anywhere

c)

A pipeline process to test and deliver software

d)

The programmatic configuration of resources

42.

When using Terraform to deploy resources into Azure, which scenarios are true regarding state files? (Choose two.)

a)

When a change is made to the resources via the Azure Cloud Console, the changes are recorded in a new state file

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

d)

When a change is made to the resources via the Azure Cloud Console, the changes are recorded in the current state file

43.

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?

a)

alias = west

b)

provider = west

c)

provider = aws.west

d)

alias = aws.west

44.

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?

a)

Add node_count = var.node_count

b)

Declare the variable in a terraform.tfvars file

c)

Declare a node_count input variable for child module

d)

Nothing, child modules inherit variables of parent module

45.

If a module declares a variable with a default, that variable must also be defined within the module.

a)

True

b)

False

46.

Terraform init can indeed be run only a few times, because, every time terraform init will initialize the project , and download all plugins from the internet repository , regardless of whether they were present or not , and this increases the waiting time

a)

True

b)

False

47.

The Terraform language does not support user-defined functions, and so only the functions built in to the language are available for use

a)

True

b)

False

48.

Which of the below configuration file formats are supported by Terraform? (Select TWO)

a)

Node

b)

JSON

c)

Go

d)

YAML

e)

HCL

49.

Please identify the offerings which are unique to Terraform Enterprise, and not available in either Terraform OSS, or Terraform Cloud. Select four.

a)

Audit Logs

b)

Private Network Connectivity

c)

VCS Integration

d)

Sentinel

e)

Clustering

50.

HashiCorp Configuration Language (HCL) supports user-defined functions.

a)

True

b)

False

51.

terraform refresh command will not modify infrastructure, but does modify the state file.

a)

True

b)

False

52.

Which of the following clouds does not have a provider maintained HashiCorp?

a)

IBM Cloud

b)

DigitalOcean

c)

OpenStack

d)

AWS

53.

You have declared a variable name my_var in terraform configuration without a value associated with it.

variable my_var {}

After running terraform plan it will show an error as variable is not defined.

a)

True

b)

False

54.

Environment variables can be used to set variables. The environment variables must be in the format "____"_<variablename>. Select the correct prefix string from the following list.

a)

TF_CLI_ARGS

b)

TF_VAR

c)

TF_VAR_

d)

TF_VAR_ENV

55.

The terraform init command is always safe to run multiple times, to bring the working directory up to date with changes in the configuration. Though subsequent runs may give errors, this command will never delete your existing configuration or state.

a)

True

b)

False