You have a Terraform project that manages infrastructure for two environments: production and staging. Which file organization below best separates environment-specific configurations while reusing common modules?
Think about how to isolate environment settings while sharing common code.
Option A is best because it uses separate folders per environment to isolate configs and a modules folder for shared code. This keeps environments clean and reusable.
Which Terraform file organization practice helps prevent state file conflicts when multiple team members work on the same infrastructure?
Think about collaboration and avoiding overwriting each other's work.
Option B is best because remote backends with locking prevent conflicts and organizing state per environment keeps states isolated.
Consider a Terraform project with two .tf files: one configures AWS provider with region us-east-1, and another configures AWS provider with region us-west-2, both without aliases. What is the expected behavior when running terraform apply?
Think about how Terraform handles multiple provider blocks of the same type.
Terraform requires multiple provider configurations of the same type to use aliases. Without aliases, it throws an error to avoid ambiguity.
Which Terraform file organization practice can lead to accidental exposure of sensitive data like secrets or passwords?
Consider what happens if secret values are stored in files tracked by Git.
Committing terraform.tfvars files with secrets in plain text to version control risks exposing sensitive data publicly or to unauthorized users.
You have a Terraform project organized with a modules/ folder containing reusable modules, and separate folders for dev/, qa/, and prod/ environments. Each environment folder has its own Terraform configuration files and remote backend configured. How many distinct Terraform state files will exist after applying all environments?
Think about how Terraform state files track resources per configuration and environment.
Each environment folder has its own configuration and backend, so each environment has one state file that includes all modules used in that environment.