nerdexam
HashiCorp

TA-002-P · Question #147

Which of the following Terraform files should be ignored by Git when committing code to a repo? (select Three)

The correct answer is A. Files named exactly terraform.tfvars or terraform.tfvars.json. B. Any files with names ending in .auto.tfvars or .auto.tfvars.json. D. terraform.tfstate. These three file types should be added to .gitignore: (A) terraform.tfvars and terraform.tfvars.json often contain sensitive variable values like passwords or API keys; (B) .auto.tfvars and .auto.tfvars.json are automatically loaded by Terraform and may also contain secrets; (D)

Understand Terraform basics

Question

Which of the following Terraform files should be ignored by Git when committing code to a repo? (select Three)

Options

  • AFiles named exactly terraform.tfvars or terraform.tfvars.json.
  • BAny files with names ending in .auto.tfvars or .auto.tfvars.json.
  • Cinput.tf
  • Dterraform.tfstate
  • Eoutput.tf

How the community answered

(21 responses)
  • A
    95% (20)
  • C
    5% (1)

Explanation

These three file types should be added to .gitignore: (A) terraform.tfvars and terraform.tfvars.json often contain sensitive variable values like passwords or API keys; (B) *.auto.tfvars and *.auto.tfvars.json are automatically loaded by Terraform and may also contain secrets; (D) terraform.tfstate contains the full state of your infrastructure including sensitive resource attributes in plaintext. Regular configuration files like input.tf and output.tf define infrastructure structure and are safe to commit.

Topics

#Git ignore#Terraform state#Terraform variables#Best practices

Community Discussion

No community discussion yet for this question.

Full TA-002-P Practice