Variables Flashcards

(33 cards)

1
Q

What are Terraform environment variables used for?

A

Configure Terraform behavior, pass secrets, and set execution parameters.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How does Terraform read environment variables?

A

Reads variables prefixed with TF_, TF_VAR_, or provider-specific prefixes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you set an environment variable in Linux/macOS?

A

export VAR_NAME=value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How do you set an environment variable in Windows?

A

set VAR_NAME=value (cmd) or $env:VAR_NAME = ‘value’ (PowerShell)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does TF_LOG do?

A

Sets the logging level (e.g., TRACE, DEBUG, INFO, WARN, ERROR).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does TF_LOG_PATH do?

A

Defines a file path to store Terraform logs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the purpose of TF_WORKSPACE?

A

Specifies the Terraform workspace in use.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What does TF_CLI_ARGS do?

A

Passes additional CLI arguments automatically to every Terraform command.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What does TF_DATA_DIR define?

A

Changes the directory where Terraform stores state files and cache.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does TF_INPUT control?

A

Determines if Terraform prompts for user input (true or false).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What does TF_REGISTRY_DISCOVERY_RETRY do?

A

Sets the number of retries for Terraform registry discovery.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What does TF_SKIP_PROVIDER_VERIFY do?

A

Skips provider binary signature verification.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What does TF_IGNORE_WARNINGS do?

A

Suppresses specific warning messages in Terraform.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What does TF_ALLOW_DYNAMIC_PIVOT do?

A

Enables dynamic pivoting of Terraform configurations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What does TF_DISABLE_PARTIAL_RETRY do?

A

Disables partial retries for Terraform operations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How do you define a Terraform input variable using environment variables?

A

Use the TF_VAR_ prefix, e.g., export TF_VAR_region=’us-west-1’.

17
Q

What is the benefit of using TF_VAR_?

A

Allows setting Terraform variables without modifying .tfvars files.

18
Q

What does TF_CLI_CONFIG_FILE specify?

A

Defines a custom Terraform CLI configuration file.

19
Q

What does TF_PLUGIN_CACHE_DIR do?

A

Sets the location to cache Terraform provider plugins.

20
Q

What does TF_IN_AUTOMATION affect?

A

Optimizes Terraform for automation by disabling interactive prompts.

21
Q

What does TF_HTTP_CREDENTIALS do?

A

Provides credentials for HTTP remote backend authentication.

22
Q

What does TF_HTTP_TIMEOUT do?

A

Sets the timeout for HTTP operations in Terraform.

23
Q

What does TF_REMOTE_STATE do?

A

Defines settings for Terraform remote state storage.

24
Q

What does TF_CLOUD_ORGANIZATION specify?

A

Defines the Terraform Cloud organization for remote execution.

25
What does TF_WORKSPACE affect in Terraform Cloud?
Selects the workspace for Terraform Cloud operations.
26
What does TF_CLOUD_HOSTNAME do?
Sets the hostname for Terraform Cloud API requests.
27
Why is TF_TOKEN_app.terraform.io used?
Stores the authentication token for Terraform Cloud.
28
What should you avoid doing with sensitive environment variables?
Avoid hardcoding them in scripts; use secret management tools instead.
29
What does TF_SECURITY_POLICY_OVERRIDE do?
Overrides specific security policies in Terraform.
30
What’s a best practice for managing environment variables in Terraform?
Store secrets securely and avoid committing them to version control.
31
How can you debug Terraform with environment variables?
Set TF_LOG=DEBUG and check logs for troubleshooting.
32
How can you persist Terraform environment variables?
Define them in shell configuration files like .bashrc or .zshrc.
33
How do you list all Terraform environment variables?
Use env | grep TF_ or printenv | grep TF_ in Linux/macOS.