Terraform Configuration Files and Overrides Quiz

AltruisticCornet avatar
AltruisticCornet
·
·
Download

Start Quiz

Study Flashcards

12 Questions

What command is used to generate a plan file in Terraform?

terraform plan -out filename

Where is the location of the AWS Config file that Terraform accesses for credentials on MacOS and Linux?

~/.aws/credentials

What is the purpose of the terraform.tfstate file in Terraform?

Tracks the IDs of created resources

Which attribute is used in Terraform to create explicit dependencies between resources?

depends_on

What is the primary purpose of Terraform's terraform show command?

Display the current state

In Terraform, what is the significance of using implicit dependencies via interpolation expressions?

Inform Terraform about resource relationships

What is the special handling of override files in Terraform?

Terraform processes override files in lexicographical order

When does Terraform automatically load files terraform.tfvars or *.auto.tfvars?

When present in the current directory

What is the purpose of a.tfvars file in Terraform?

Assign values to already declared variables

Which command is used to preview the changes without altering the backend state?

terraform plan

What does Terraform search for in its own process environment for variable values?

Environment variables with TF_VAR_ prefix

What happens when override files are over-used in Terraform?

Hurts readability

Study Notes

Terraform Fundamentals

  • Terraform configuration files are often called configuration files.
  • Terraform loads all files ending in .tf in a directory.

Terraform Plan

  • terraform plan -out filename generates a plan file, which is a zip file.
  • The plan file can be used when applying: terraform apply "nat.tfplan".

Terraform Validate

  • terraform validate validates the syntax.

Terraform Plan Options

  • terraform plan [-destroy] generates an execution plan for Terraform.

Provider Configuration

  • The profile attribute refers to the AWS Config File in ~/.aws/credentials on MacOS and Linux or %UserProfile%\.aws\credentials on a Windows system.
  • It is recommended not to hardcode credentials into .tf configuration files.
  • The provider "aws" block defines the default AWS config profile and region.

Resource Blocks

  • A resource block has two strings before opening the block: the resource type and the resource name.
  • Each "Provider" is its own encapsulated binary distributed separately from Terraform itself.
  • The terraform init command will automatically download and install any Provider binary for the providers in use within the configuration.

Terraform State

  • Terraform writes data into the terraform.tfstate file, which keeps track of the IDs of created resources.
  • This state file is extremely important and must be saved and distributed to anyone who might run Terraform.
  • terraform show can be used to inspect the current state.

Resource Dependencies

  • Implicit dependencies via interpolation expressions are the primary way to inform Terraform about relationships.
  • The depends_on argument is accepted by any resource and accepts a list of resources to create explicit dependencies.

Override Files

  • Terraform has special handling of any configuration file whose name ends in _override.tf or _override.tf.json.
  • Override files are processed in lexicographical order after the initial configuration file.
  • Use override files only in special circumstances, as over-use hurts readability.

Variable Definitions

  • Terraform searches the environment of its own process for environment variables named TF_VAR_ followed by the name of a declared variable.
  • Terraform automatically loads .tfvars or *.auto.tfvars files present in the current directory to populate variables.
  • A .tfvars file is used to assign values to variables, not to declare new variables.

Test your knowledge on Terraform configuration files and overrides. Learn about how Terraform handles files with names ending in _override.tf or _override.tf.json, and how these files are processed in lexicographical order.

Make Your Own Quizzes and Flashcards

Convert your notes into interactive study material.

Get started for free

More Quizzes Like This

Use Quizgecko on...
Browser
Browser