Associate Exam Flashcards

1
Q

Is locking happening automatically?

A

YES

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is “terraform taint” command?

A

Informs Terraform that a particular object has become degraded or damaged. Terraform represents this by marking the object as “tainted” in the Terraform state, in which case Terraform will propose to replace it in the next plan you create.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Command to create new workspace

A

terraform workspace new NAME

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Flag used to identify the specific version of a provider required.

A

required_providers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

In which config block Terraform-specific setting are declared?

A

terraform

terraform {

required_providers {

aws = {

version = “>= 2.7.0”

source = “hashicorp/aws”

}

}

}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which command allow to retrieve a list of resources that are part of the state file?

A

terraform state list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Where local state is stored for a workspaces?

A

directory called terrraform.tfstate.d

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Can Terraform backed be migrated without de-provisioning the resources?

A

YES

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Where is the workspaces local state stored?

A

Directory terraform.tfstate.d

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What kind of resource dependany is stored in terraform.tfstate file?

A

Both implicit and explicit

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

The most verbose logging level

A

trace

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How to hide the output value in CLI?

A

use “sensitive” parameter

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Which command will upgrade the provider to the latest acceptable one?

A

terraform init -upgrade

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Can you publish your own modules in Terraform Registry?

A

YES

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Connection types supported by remote-exec?

A
  • ssh
  • winrm
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What’s the purpose of remote-exec?

A

Invokes a script on a remote resource after it is created

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Features exclusive to Terraform Enterpise

A
  • Audit logs
  • Clustering
  • SAML/SSO
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What are limitations of SENSITIVE parameter?

A

The values are stored in the Terraform state and available using the terraform output command, so cannot be relied on as a sole means of protecting values.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Two Terraform versions

A
  • open source
  • enterprise
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What is terraform import?

A

This allows to take resource created by some other means and bring it under Terraform mangement.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

The purpose of “terraform validate” command.

A

Validates the configuration files in a directory, referrring only to the configuration and not accessing any remote services such as remote state, provider API, etc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What is a downside to using the Vault provider to read secrets from Vault?

A

Any secrets that you read and write to be persisted in both Terraform’s state file and in any generated plan files. For any Terraform module that reads or writes Vault secrets, these files should be treated as sensitive and protected accordingly.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

When writing terraform code, HashiCorp recommends that you use how many spaces between each nesting level

A

2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

After executing a terraform apply. you notice that a resoruce has a tilde (~) next to it. What does this infer?

A

The resource will be updated in place

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

How local path must begin for local module

A

”./” or “../”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

Which type of variable allows multiple values of several distinct types to be grouped together as a single value?

A
  • object
  • list
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

Which command can be used to view th specified version constraint for all providers used in the current configuration?

A

terraform providers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

Is Role Based Access Control free?

A

NO

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

When should you use the force-unlock command?

A

Automatic unlocking failed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

In order to reduce the time it takes to provision resources, Terraform uses parallelism. By default, how many resources will Terraform provision concurrently?

A

10

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

What can outputs be used for?

A
  • User reference
  • Input to other resources being created via terraform
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

What is the statement that follows the resource in a terraform block called? IE resource “” “” {

A

Resource block

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

For an output what happens if you do not supply an attribute?

A

The output will provide all the attributes associated with the resource

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

What are attributes?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

What is an output?

A

A way to output specific attributes of a resource

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

Where can you assign variables?

A
  • Environment variables
  • Command Line Flags
  • From a File
  • Variable Defaults
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q

What is a type argument in a variable block?

A

the type argument in a variable block allows you to restrict the type of value that will be accepted as the value for a variable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
38
Q

What is a type list

A

Sequential list of values identified by their position. Starts with 0
[
“apple”,
“orange”,
“pear”
]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
39
Q

What is a type map

A

a group of values identified by name labels, like
{
name = “Mabel”,
age = “52”
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
40
Q

How can you reference a specific position in a list

A

var.[position (i.e. 1)]

41
Q

What is a local value?

A

A local value assigns a name to an expression, allowing it to be used multiple times within a module without repeating it.

42
Q

What is the general syntax of a function?

A

function(argument 1, argument 2)

43
Q

What are the categories of functions in use by Terraform?

A

Numeric
String
Collection
Encoding
Filesystem
Date and Time
Hash and Crypto
IP Network
Type Conversion

44
Q

Where can you test terraform functions?

A

terraform console

45
Q

What does a lookup do?

A

retrieves the value of a single element from a map, given its key. If the given key does not exist, a the given default value is returned instead.

46
Q

What does an element do?

A

retrieves a single element from a list.

47
Q

What do data source allow

A

Data sources allow data to be fetched or computed for use elsewhere in Terraform configuration.

48
Q

How can you setup detailed logs for debugging

A

You can set TF_LOG to one of the log levels

49
Q

How do you enable logging?

A

by exporting the logs and setting a verbosity level from the local console
- export TF_LOG=

50
Q

How can you export Terraform Logs to a file?

A

by specifying a log path to export the TF logs to
- export TF_LOG_PATH=

51
Q

What is the most verbose level of TF_LOG?

A

Trace

52
Q

How can you validate the terraform configuration files for systematic validation?

A

terraform validate

53
Q

What is the Terraform State File?

A

The state allows terraform to map real world resources to existing configuration. Terraform stores the state of the infrastructure in TF files

54
Q

What is a desired state?

A

The specific configuration defined in a resource block is what creates a desired state

55
Q

What is terraform refresh

A

Terraform refresh fetches the latest information about the current state of your infrastructure.

56
Q

What does Terraform plan do?

A

Match the desired state with the current state

57
Q

What does terraform show do?

A

Shows all information within the terraform state file

58
Q

Can Terraform providers have a different provider plugin version that Terraform?

A

Yes

59
Q

Where are terraform plugins installed?

A

.terraform/plugins directory

60
Q

Can you specify a specific version number or a base version number for installing a provider?

A

Yes by providing a version statement in the provider configuration block

61
Q

How can you obtain HashiCorp Distributed providers?

A

They are automatically downloaded during terraform init

62
Q

How can you obtain non distributed providers?

A

Manually installed locally

63
Q

Where do you download and install plugins for manual installation?

A
  • ~/.terraform.d/plugins directory
  • All manual plugins should be copied into the above directory
  • Terraform init will read from the ~/.terraform/plugins directory
64
Q

What are terraform provisioners?

A

Provides the ability to configure an added resource using a defined script

65
Q

How many types of provisioners are there?

A

2

66
Q

What are the types of provisioners?

A
  • local-exec
  • remote-exec
67
Q

What does a local-exec provisioner allow?

A

local-exec provisioners allow us to invoke local executable after resource is created

68
Q

What does a remote-exec provisioner allow?

A

Remote-exec provisioners allow to invoke scripts directly on the remote server

69
Q

What is required for a provisioner to run scripts on the remote server?

A

connection block with login information

70
Q

What are the two types of provisioners?

A
  • Creation-Time Provisioner
  • Destroy-Time Provisioner
71
Q

What is a creation-time provisioner?

A
  • creation time provisioners are only run during creation, not during updating or any other lifecycle
  • If a creation-time provisioner fails, the resource is marked as tainted
72
Q

What is a destroy-time provisioner?

A

destroy provisioners are run before the resource is destroyed

73
Q

When is a destroy provisioner invoked?

A

when = destroy is added to the provisioner block

74
Q

What does the on_failure setting do?

A

Ignore the error and continue with creation or destruction

75
Q

What is the DRY Principle

A

Dont Repeat Yourself

76
Q

What is the terraform registry?

A

modules that have already been written by the TF community

77
Q

How do you know if the input is required?

A

check the registry Note and Inputs section of the resource group

78
Q

What does multiple workspaces allow for in Terraform?

A

Terraform allows us to have multiple workspaces, with each of the workspaces we can have different set of environment variables associated.

79
Q

What command allows me to switch between workspaces?

A

terraform workspace

80
Q

What are the sub commands for terraform workspace?

A
  • delete
  • list
  • new
  • select
  • show
81
Q

What does the start denote when you run a terraform workspace show

A

what environment you are in

82
Q

What is terraform state file locking?

A

Whenever you are performing a write operation, terraform would lock the state file.

83
Q

Is locking available in S3?

A

No

84
Q

How can you create a locking mechanism for tfstate files stored in s3?

A

integrate dynamodb

85
Q

The current implementation of Terraform import can only import resources into the state. It does not generate configuration.

A

true

86
Q

You want to use terraform import to start managing infrastructure that was not originally provisioned through infrastructure as code. Before you can import the resource’s current state, what must you do in order to prepare to manage these resources using Terraform?

A

Update the configuration file to include the new resources.

87
Q

Usage of “terraform refresh” command

A

The terraform refresh command is used to reconcile the state Terraform knows about (via its state file) with the real-world infrastructure. This can be used to detect any drift from the last-known state, and to update the state file. This does not modify infrastructure, but does modify the state file.

88
Q

During a terraform plan, a resource is successfully created but eventually fails during provisioning. What happens to the resource?

A

the resource is marked as tainted

89
Q

You want to evaluate an expression in terraform before appying it. What command do you use?

A

Console

90
Q

Command to unlock the locked state file

A

force-unlock

91
Q

Command used to automatically obtain and save an API token for Terraform Cloud, Terraform Enterprise, or any other host that offers Terraform services

A

terraform login

92
Q

Command to inspect the current state files

A

terraform show

93
Q

Databse used by backend terraform enterpsie

A

postgresql

94
Q

Environment variables format

A

TF_VAR_name

95
Q

Command to Force plugin installation to read plugins only from the specified directory

A

terraform init -plugin-dir=PATH

96
Q

Terraform Plugins language

A

Go

97
Q

Command to manually unlock the state for the defined configuration.

A

terraform force-unlock [options] LOCK_ID [DIR]

98
Q

Which backen has default state locking?

A
  • azurerm
  • gcs
99
Q

Which terraform command reads the current settings from all managed remote objects and updates the Terraform state to match

A

tarraform refresh