Exam Prep v2 Flashcards
Skillcertpro (85 cards)
How to taint the resource of a child module?
Ex: Parent Module == foo
Child Module == bar
terraform taint module.foo.module.bar.aws_instance.qux
Which config block assigns a name to an expression that can be used multiple times w/in a module w/out having to repeat it?
Locals block.
What operating systems are supported by Terraform?
Linux distributions (Debian, ubuntu,centOS)
macOS (Darwin)
Windows
Solaris
FreeBSD
OpenBSD
Hashicorp recommends how many spaces fore each nesting level?
2
How are environment variables set on the command line?
TF_VAR_name
Ex. export TF_VAR_region=us-west-1
Does HCP Terraform/Terraform Enterprise install provers as part of every run?
Yes
Which command is u sed to get a human-friendly output of the resources contained in your state?
terraform show
What source types can be considered while providing source arguments in module block?
Local paths
Terraform registry
Github
Bitbucket
HTTP URL’s
S3 buckets
Is Terraform a configuration management tool?
No, its an IaC tool.
What two use cases does terraform mv do?
It can move resources from one state file to another and also rename resources.
terraform state mv -state-out=../terraform.tfstate aws_instance.example_new aws_instance.example_new
Regarding module meta arguments, if your instances are almost identical, does the count need to be used?
Yes
Regarding module meta arguments, if your instance arguments need distinct values that cant be directly derived from an integer, is it safer to use a for_each?
Yes
What function is used to explicitly convert a list of integers to a set?
toset
Is it true that a child module can use outputs to expose a subset of its resources to a parent module?
Yes, think of outputs as the “return values” of a TF module, enabling info to flow from a child back to its parent.
Is it true that a parent module can reference that result using the expression module.<MODULE_NAME>. <output_name>?</output_name></MODULE_NAME>
Yes,
the module_name is the name given to the child module instance and the output_name is the name of the output variable declared in the child module.
How to load custom tfvars file as an input variable during terraform apply?
terraform apply -var-file=”name.tfvars”
Can you mix/match creation and destruction provisioners in the same file?
Yes
Whats true w.r to storing sensitive data in a remote locaiton?
TF Cloud always encrypts state at rest and protects w/TLS in transit.
TF Enterprise also supports detailed audit logging
TF CLoud knows the identity of the user requesting state and maintains a history of state changes.
Can you enable logging separately for Terraform itself?
Yes, you’d use the command
export TF_LOG_CORE=TRACE
Can you enable logging separately for the provider plugins?
Yes, you’d use the command
export TF_LOG_PROVIDER=TRUE
Are modules containers for multiple resources that are used together?
Yes
Does a module consist of a collection of .tf and/or .tf.json files kept together in a directory?
Yes
Are modules the main way to package and reuse resource configs w/TF?
Yes
What are the different planning modes available in TF?
- Destroy mode (-destroy) - plan to destroy all remote objects
- Refresh only (-refresh-only) - to update TF state/root module output values