Terraform Last Minute Notes
Terraform Last Minute Notes
One remote backend configuration always maps to a single remote workspace - False
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
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.
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
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
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
What command should you run to display all workspaces for the current
configuration? - terraform workspace list
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
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
Store the state in an encrypted backend if there are secrets in state files.
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
Terraform provisioners that require authentication can use the _______ block. -
connection
With two spaces - indent each nesting level compared to the one above it