Terraform Associate Flashcards

1
Q

Select the available arguments that are available for the lifecycle meta-argument

  1. create_before_destroy
  2. prevent_destroy
  3. ignore_change
  4. ignore_changes
  5. destroy_after_create
A
  1. create_before_destroy
  2. prevent_destroy
  3. ignore_changes
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

terraform import command updates the configuration files as well as the state file, with the details of the infrastructure being imported.

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

Can we use dynamic blocks to generate meta-argument blocks such as lifecycle and provisioner blocks?

  1. True
  2. False
A
  1. False

A dynamic block can only generate arguments that belong to the resource type, data source, provider, or provisioner being configured. It is not possible to generate meta-argument blocks such as lifecycle and provisioner blocks, since Terraform must process these before it is safe to evaluate expressions.

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

Which of the following is not the valid sub-command of terraform state command?

  1. state list
  2. state replace
  3. state pull
  4. state rm
  5. state show
  6. state mv
A
  1. state replace
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Select the optional arguments that are available for the output block.

  1. description
  2. depends_on
  3. sensitive
    4 . All of the above
A
  1. All of the above
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

The for_each meta-argument accepts:

  1. set of strings
  2. map
  3. list of strings
  4. Only alphanumeric strings
A
  1. set of strings
  2. map
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

You were working with different terraform scripts which are provisioning various sets of resources , you need to look up for some additional details related to one specific resource from the state file. Which terraform command will help you achieve this?

  1. terraform state list ADDRESS
  2. terraform show ADDRESS
  3. terraform get ADDRESS
  4. terraform state show ADDRESS
A
  1. terraform state show ADDRESS
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the options that best correspond to the definition of local-only data sources:

  1. Local-only data sources behave similarly to local values declared using locals block
  2. Local-only data sources are exactly the same as normal data sources
  3. It is the same as all other data sources, but their result data exists only temporarily during a Terraform operation
  4. It is re-calculated each time a new plan is created
A
  1. It is the same as all other data sources, but their result data exists only temporarily during a Terraform operation
  2. It is re-calculated each time a new plan is created
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Is it possible for a Terraform configuration to have no modules and still works?

  1. Terraform configuration needs at least one child module along wit the root module
  2. Terraform configuration needs at least one one module, i.e. Root module
  3. None of the options are correct
  4. It will work with no errors
A
  1. Terraform configuration needs at least one one module, i.e. Root module
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Which of the following function is no longer available in terraform:

  1. zipmap()
  2. map()
  3. tomap()
  4. None of the above
A
  1. map()
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Which option best describes the meaning of interpolation syntax?

  1. None of the above
  2. A way to declare values to variables
  3. A way to provide runtime options with terraform operations
  4. A way to reference variables, attributes or resources, and call functions
A
  1. A way to reference variables, attributes or resources, and call functions
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Select the reasons why we may need to specify the provider’s argument?

  1. No specific reason
  2. To change the default provider configurations
  3. To use multiple provider plugins in the same configuration
  4. It’s just a practice we need to blindly follow
  5. To use multiple configurations of the same provider
A
  1. To change the default provider configurations
  2. To use multiple configurations of the same provider
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Which argument of the lifecycle meta-argument supports a list as a value ?

  1. prevent_destroy
  2. All the options
  3. create_before_destroy
  4. ignore_changes
A
  1. ignore_changes

ignore_changes (list of attribute names) - By default, Terraform detects any difference in the current settings of a real infrastructure object and plans to update the remote object to match configuration.

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

Logging can not be enabled separately for the provider plugins using the TF_LOG_PROVIDER environment variable.

  1. True
  2. False
A
  1. False

Logging can be enabled separately for terraform itself and the provider plugins using the TF_LOG_CORE or TF_LOG_PROVIDER environment variables. These take the same level arguments as TF_LOG, but only activate a subset of the logs.

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

What will happen if Terraform isn’t able to obtain acceptable versions of external dependencies, or if it doesn’t have an acceptable version of itself?

  1. It won’t proceed with any plans, applies, or state manipulation actions
  2. None of the options
  3. It will attempt to download the newest version that meets the application constraints
  4. It will ignore such errors and proceed without warning
A
  1. It won’t proceed with any plans, applies, or state manipulation actions

Both the root module and any child module can constrain the acceptable versions of Terraform and any providers they use. Terraform considers these constraints equal, and will only proceed if all of them can be met.

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

Terraform assumes an empty default configuration for any provider that is not explicitly configured.

  1. True
  2. False
A
  1. True

Unlike many other objects in the Terraform language, a provider block may be omitted if its contents would otherwise be empty. Terraform assumes an empty default configuration for any provider that is not explicitly configured.

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

Which of the following Terraform commands will automatically refresh the state unless supplied with additional flags or arguments? Choose TWO correct answers.

  1. terraform plan
  2. terraform state
  3. terraform apply
  4. terraform validate
  5. terraform output
A
  1. terraform plan
  2. terraform apply
18
Q

Setting a variable as sensitive stops Terraform from displaying its value in the plan or apply output.

  1. Yes, Terraform will always redact the values of variables marked as sensitive from the standard error and output of its commands or log messages.
  2. Yes, however a provider error could still expose sensitive data if the value is included in the error message.
  3. The sensitive argument is deprecated in the latest version of Terraform as the data in the Terraform state is still in plain text.
  4. The variable declaration block does not support the sensitive argument.
A
  1. Yes, however a provider error could still expose sensitive data if the value is included in the error message.
19
Q

terraform init cannot automatically download third-party providers.

  1. True
  2. False
A
  1. False
20
Q

What features are only available with Terraform Enterprise? Select every matching option. Choose TWO correct answers.

  1. Sentinel
  2. Log forwarding
  3. Audit logging
  4. Cross-organisation registry sharing
  5. SAML single sign-on
A
  1. Log forwarding
  2. Cross-organisation registry sharing
21
Q

Child modules never automatically inherit additional provider configurations.

  1. True
  2. False
A
  1. True
22
Q

For creating new virtual machines (VMs) for a cloud provider, you developed a Terraform module. Your testing in a development environment with a couple virtual machines went without a hitch. So you began utilising this module in production and used it to launch hundreds of virtual machines (VMs). Over time, you noticed a slowdown in the execution of terraform plan and apply commands. What may be the cause of the slowness? Choose THREE correct answers.

  1. By default, for every plan and apply, Terraform will sync all resources in your state with the real world to know the current state of resources to effectively determine the changes that it needs to make to reach your desired configuration. For large infrastructures, this behaviour of querying every resource makes plan and apply command execution very slow.
  2. Many cloud providers do not provide APIs to query multiple resources at once, and the round-trip time for each resource is hundreds of milliseconds; hence, for a large infrastructure, querying every resource causes slowness during the plan and apply command.
  3. The VM running Terraform CLI has insufficient resources.
  4. Terraform creates one VM at a time; hence, plan and apply commands were fast during testing since you only created a few VMs, but on production, you may have to create many VMs at a time, which makes it slow.
  5. Cloud providers have API rate-limiting, and for a large infrastructure, Terraform has to make a lot of calls to query every resource; hence, API rate-limitation stops Terraform from making many concurrent API calls at once that make a plan and apply commands slow.
A
  1. By default, for every plan and apply, Terraform will sync all resources in your state with the real world to know the current state of resources to effectively determine the changes that it needs to make to reach your desired configuration. For large infrastructures, this behaviour of querying every resource makes plan and apply command execution very slow.
  2. Many cloud providers do not provide APIs to query multiple resources at once, and the round-trip time for each resource is hundreds of milliseconds; hence, for a large infrastructure, querying every resource causes slowness during the plan and apply command.
  3. Cloud providers have API rate-limiting, and for a large infrastructure, Terraform has to make a lot of calls to query every resource; hence, API rate-limitation stops Terraform from making many concurrent API calls at once that make a plan and apply commands slow.
23
Q

When the TF_LOG_PATH is set to a log file to persist logs, the TF_LOG must also be set in order for any logging to be enabled.

  1. True
  2. False
A
  1. True
24
Q

Terraform can be used to codify the configuration for software-defined networks.

  1. True
  2. False
A
  1. True
25
Q

Consider the configuration provided below and select the output if a user uses the file terraform.tfvars given below provide value to the variable user_details.

Terraform Configuration

variable “user_details” {
type = object({ name = string, age = number })
}

output “user_details_output” {
value = var.user_details
}

Content of terraform.tfvars file

user_details = {
name = “Peter Griffin”
age = 46
city = “Quahog”
show = “Family Guy”
}

  1. Error: Invalid value for input variable
  2. user_details_output = {
    “age” = 46
    “name” = “Peter Griffin”
    }
  3. user_details_output = {
    “age” = 46
    “city” = “Quahog”
    “name” = “Peter Griffin”
    “show” = “Family Guy”
    }
  4. user_details_output = {
    “age” : 46,
    “name” : “Peter Griffin”
    }
A
  1. user_details_output = {
    “age” = 46
    “name” = “Peter Griffin”
    }
26
Q

Terraform can be used to handle low-level components like networking, storage, and compute instances, as well as high-level components like SaaS features and DNS data.

  1. True
  2. False
A
  1. True
27
Q

Sentinel is a __________ service that prevents the provisioning of out-of-policy infrastructure.

  1. Reactive
  2. Prescriptive
  3. Prescribed
  4. Proactive
  5. Passive
A
  1. Proactive
28
Q

Can we create multiple instances of a module from a single module block defined in your Terraform configuration? Choose TWO correct answers.

  1. Yes, this feature was added to Terraform 0.11.
  2. Yes, you can use the for_each property, which takes a map (with string keys) to specify several instances of a module. Lists or sets of strings are not supported.
  3. Yes, this feature was added to Terraform 0.13.
  4. No, as this would result in many module instances of the same module having the same input variables. This is a valid case for a resource block, where you may construct several resources of the same type, but not for a module block.
  5. No, a module block cannot allow the usage of the for_each or count arguments.
  6. Yes, use the for_each or count argument to create multiple instances of a module from a single module block, similar to the resource block.
A
  1. Yes, this feature was added to Terraform 0.13.
  2. Yes, use the for_each or count argument to create multiple instances of a module from a single module block, similar to the resource block.
29
Q

You want to use an archive stored in S3 as a module source. Is it necessary for the S3 archive to be publicly accessible in order for Terraform to utilise it?

module “vpc” {
source = “s3::https://s3-eu-west-1.amazonaws.com/quiz-experts-s3/vpc.zip”
}

  1. Yes
  2. No
A
  1. No
30
Q

Terraform forces every state modification command to write a backup file.

  1. True
  2. False
A
  1. True
31
Q

You must first write a resource block for each manually built infrastructure resource in your configuration, naming it anything you want Terraform to know, before you can use it to manage resources using Terraform.

  1. True
  2. False
A
  1. True
32
Q

All input variables of a root-module are available to the child-module by default.

  1. True
  2. False
A
  1. False
33
Q

Pushing a dependency lock file to a version control repository can expose sensitive cached data.

  1. True
  2. False
A
  1. False
34
Q

The parent module has to provide input variables and providers to a child module explicitly in the module block, as this information cannot be passed down to descendant modules implicitly through inheritance.

  1. True
  2. False
A
  1. False
35
Q

The terraform apply -refresh-only command is used to reconcile the state Terraform knows via its _______ with the real-world infrastructure.

  1. Provider
  2. Configuration files
  3. .tf files
  4. State file
A
  1. State file
36
Q

module “vpc” {
source = “________________________________”
version = “0.9.3”
}

  1. <HOSTNAME>/<NAMESPACE>/<PROVIDER>/<NAME>
    </NAME></PROVIDER></NAMESPACE></HOSTNAME>
  2. <HOSTNAME>/<NAMESPACE>/<NAME>/<PROVIDER>
    </PROVIDER></NAME></NAMESPACE></HOSTNAME>
  3. <NAMESPACE>/<NAME>/<PROVIDER>
    </PROVIDER></NAME></NAMESPACE>
  4. <HOSTNAME>/<NAME>/<PROVIDER>
    </PROVIDER></NAME></HOSTNAME>
  5. <NAMESPACE>/<PROVIDER>/<NAME>
    </NAME></PROVIDER></NAMESPACE>
A
  1. <HOSTNAME>/<NAMESPACE>/<NAME>/<PROVIDER>
    </PROVIDER></NAME></NAMESPACE></HOSTNAME>
37
Q

Fill in the blanks: The ______ environment variable can enable detailed Terraform logs to appear on _______.

  1. First - TF_LOG
    Second - stderr
  2. First - TF_LOGS
    Second - stdout
  3. First - TF_PATH
    Second - stderr
  4. First - TF_CRASH_LOG
    Second - stdout
  5. First - TF_LOG
    Second - stdout
A
  1. First - TF_LOG
    Second - stderr
38
Q

Which of the following variable types allows multiple values of several distinct types to be grouped together as a single value? Choose TWO correct answers.

  1. Tuple
  2. Object
  3. Set
  4. List
  5. Map
A
  1. Tuple
  2. Object
39
Q

Version constraints are supported only for modules installed from a module registry.

  1. True
  2. False
A
  1. True
40
Q

A calling module can directly access child module resource attributes.

  1. True
  2. False
A
  1. False
41
Q
A