0% found this document useful (0 votes)
2 views

Terraform Last Minute Notes

The document contains various true/false statements and questions related to Terraform, covering topics such as state management, provisioners, backend configurations, and best practices. It highlights key commands like 'terraform init', 'terraform taint', and 'terraform refresh', as well as the importance of managing sensitive data. Additionally, it discusses Terraform's module and variable handling, along with configuration best practices.

Uploaded by

achopraterr
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Terraform Last Minute Notes

The document contains various true/false statements and questions related to Terraform, covering topics such as state management, provisioners, backend configurations, and best practices. It highlights key commands like 'terraform init', 'terraform taint', and 'terraform refresh', as well as the importance of managing sensitive data. Additionally, it discusses Terraform's module and variable handling, along with configuration best practices.

Uploaded by

achopraterr
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

The terraform.

tfstate file always matches your currently built infrastructure -


False

One remote backend configuration always maps to a single remote workspace - 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 - terraform taint
null_resource.run_script

Which provisioner invokes a process on the resource created by Terraform? -


remote-exec

What command does Terraform require the first time you run it within a
configuration directory? - terraform init

Run terraform state list to find the name of the resource, then terraform state
show to find the attributes including public IP address

Terraform variables and outputs that set the "description" argument will store that
description in the state file. - False

If you manually destroy infrastructure, what is the best practice reflecting this
change in Terraform? - Run terraform refresh

What is not processed when running a terraform refresh? - Configuration file &
Cloud Provider

If a module uses a local values, you can expose that value with a terraform output.
- True

You should store secret data in the same version control repository as your
Terraform configuration. - False

Which of the following is not a valid string function in Terraform? - slice

To manage a resource that was created manually using Terraform you have to import
the resource steps
1.Create a configuration file
2.Run import

Terraform init doesn't initializes a sample main.tf file in the current directory.

The terraform taint command informs Terraform that a particular object has become
degraded or damaged. Terraform represents this by marking the object as "tainted"
in the Terraform state, and Terraform will propose to replace it in the next plan
you create.

terraform validate validates the syntax of Terraform files.

A Terraform provisioner must be nested inside a resource configuration block. -


True

What does the default "local" Terraform backend store? - State File

Which task does terraform init not perform? - Validates all required variables are
present

list of the IDs from var.list - var.list[*].id & [ for o in var.list : o.id ]
How do you specify version 1.0.0 in module? - Add version = "1.0.0" attribute to
module block

What features does the hosted service Terraform Cloud provide?


C. Remote state storage
D. A web-based user interface (UI)

Where does the Terraform local backend store its state? - In the terraform.tfstate
file

Which option can not be used to keep secrets out of Terraform configuration files?
- secure string

What is one disadvantage of using dynamic blocks in Terraform? - They make


configuration harder to read and understand

Only the user that generated a plan may apply it. - False

You need to specify a dependency manually.What resource meta-parameter can you use
to make sure Terraform respects the dependency?
depends_on

Setting the TF_LOG environment variable to DEBUG causes debug messages to be logged
into syslog. - False

Where in your Terraform configuration do you specify a state backend? - Terraform


Block

In Terraform 0.13 and above, outside of the required_providers block, Terraform


configurations always refer to providers by their local names. - True

What command should you run to display all workspaces for the current
configuration? - terraform workspace list

Terraform providers are always installed from the Internet. - False

Which of these is the best practice to protect sensitive values in state files? -
Enhanced remote backends

When does terraform apply reflect changes in the cloud environment? - 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? - aws_instance.web[1].name

Terraform provisioners can be added to any resource block. - True

What is terraform refresh intended to detect? - State file drift

Which flag would you add to terraform plan to save the execution plan to a file? -
-out=FILE

What is the name of the default file where Terraform stores the state? -
terraform.tfstate

A Terraform local value can reference other Terraform local values. - True
Which of the following is not a valid Terraform collection type? - tree

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

You would like to reuse the same Terraform configuration for your development and
production environments with a different state file for each. - Terraform Workspace

You're building a CI/CD (continuous integration/ continuous delivery) pipeline and


need to inject sensitive variables into your Terraform run. - Copy the sensitive
variables into your Terraform code

Store the state in an encrypted backend if there are secrets in state files.

Set the environment variable TF_LOG=TRACE = enable debug message

most secure place to store secrets for connecting to a Terraform remote backend? -
Defined in Environment variables

When you initialize Terraform, where does it cache modules from the public
Terraform Module Registry? - On disk in the .terraform sub-directory

example to set a version = version = ">= 2.1"

Terraform provisioners that require authentication can use the _______ block. -
connection

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


blocks? - dynamic.

Modules do not inherit variables from the parent module

With two spaces - indent each nesting level compared to the one above it

You might also like