Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Recall & Review
beginner
What is the purpose of provider caching in Terraform?
Provider caching stores downloaded provider plugins locally to speed up future Terraform runs and reduce network usage.
Click to reveal answer
beginner
How do provider mirrors help in Terraform?
Provider mirrors act as local or private repositories that serve provider plugins, improving reliability and control over provider versions.
Click to reveal answer
intermediate
Where does Terraform store cached providers by default?
Terraform stores cached providers in a hidden directory named .terraform/providers in the working directory and also in a global plugin cache directory.
Click to reveal answer
intermediate
How can you configure Terraform to use a provider mirror?
You configure provider mirrors by setting the 'provider_installation' block in the CLI configuration file to point to the mirror URL or local path.
Click to reveal answer
intermediate
Why is using provider mirrors beneficial in an offline or restricted network environment?
Provider mirrors allow Terraform to install providers without accessing the public internet, ensuring Terraform runs smoothly in offline or restricted networks.
Click to reveal answer
What does Terraform use provider caching for?
ATo store provider plugins locally for faster reuse
BTo cache Terraform state files
CTo save configuration files
DTo backup cloud resources
✗ Incorrect
Terraform caches provider plugins locally to avoid downloading them every time, speeding up runs.
Which file do you edit to configure provider mirrors in Terraform?
Aterraform.tfvars
BCLI configuration file (e.g., ~/.terraformrc)
Cmain.tf
Dprovider.tf
✗ Incorrect
Provider mirrors are configured in the CLI configuration file, such as ~/.terraformrc or terraform.rc.
What is a key benefit of using a provider mirror?
AAvoiding internet access for provider downloads
BFaster Terraform plan execution
CAutomatically updating providers
DEncrypting provider plugins
✗ Incorrect
Provider mirrors let Terraform download providers without internet access, useful in restricted environments.
Where does Terraform NOT store provider plugins by default?
A.terraform/providers directory
BGlobal plugin cache directory
CLocal working directory
DCloud provider's API
✗ Incorrect
Terraform does not store provider plugins in the cloud provider's API; it caches them locally.
Which block is used to define provider installation methods including mirrors?
Aterraform_block
Bprovider_config
Cprovider_installation
Dplugin_cache
✗ Incorrect
The 'provider_installation' block in the CLI config defines how Terraform installs providers, including mirrors.
Explain how provider caching and mirrors improve Terraform's performance and reliability.
Think about speed and network access.
You got /4 concepts.
Describe the steps to configure a provider mirror in Terraform.
Focus on the CLI config file and the provider_installation block.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of provider caching in Terraform?
easy
A. To encrypt provider plugins for security
B. To store provider plugins locally and speed up Terraform runs
C. To delete unused providers automatically
D. To force Terraform to always download providers from the internet
Solution
Step 1: Understand provider caching concept
Provider caching means saving provider plugins on your local machine so Terraform doesn't need to download them every time.
Step 2: Identify the benefit of caching
This local storage speeds up Terraform runs by avoiding repeated downloads.
Final Answer:
To store provider plugins locally and speed up Terraform runs -> Option B
Quick Check:
Provider caching = local storage for speed [OK]
Hint: Caching means saving locally to avoid repeated downloads [OK]
Common Mistakes:
Thinking caching deletes providers
Confusing caching with encryption
Assuming caching forces downloads
2. Which block is used in Terraform configuration to specify a local directory for provider caching?
easy
A. direct
B. cache_location
C. filesystem_mirror
D. provider_cache
Solution
Step 1: Recall Terraform provider mirror blocks
Terraform uses filesystem_mirror blocks to define local directories for caching providers.
Step 2: Confirm correct block name
The direct block is for direct downloads, not caching. Other options are invalid.
Final Answer:
filesystem_mirror -> Option C
Quick Check:
Local cache directory = filesystem_mirror [OK]
Hint: Filesystem mirror means local cache folder [OK]
Common Mistakes:
Confusing direct with caching block
Using non-existent block names
Assuming provider_cache is valid
3. Given this Terraform CLI configuration snippet:
What happens when Terraform needs the hashicorp/aws provider?
medium
A. Terraform downloads hashicorp/aws directly from the internet
B. Terraform uses the cached version from /cache/providers
C. Terraform throws an error because hashicorp/aws is excluded
D. Terraform ignores the provider and continues without it
Solution
Step 1: Analyze the filesystem_mirror and direct blocks
The filesystem_mirror caches providers locally except those excluded in direct.
Step 2: Understand the exclude setting
The direct block excludes hashicorp/aws, so Terraform will not use the cache for it.
Step 3: Determine provider source
Terraform downloads hashicorp/aws directly from the internet.
Final Answer:
Terraform downloads hashicorp/aws directly from the internet -> Option A
Quick Check:
Exclude means direct download [OK]
Hint: Exclude in direct means download from internet [OK]
Common Mistakes:
Assuming excluded providers use cache
Thinking exclusion causes errors
Believing providers are ignored if excluded
4. You configured a filesystem_mirror path but Terraform still downloads providers from the internet. What is the most likely cause?
medium
A. The filesystem_mirror path is incorrect or inaccessible
B. Terraform does not support provider caching
C. You forgot to install Terraform CLI
D. The provider version is not specified in configuration
Solution
Step 1: Check filesystem_mirror path validity
If the path is wrong or Terraform cannot access it, caching won't work and providers download from the internet.
Step 2: Rule out other causes
Terraform supports caching, CLI must be installed, and version absence doesn't force downloads if cache is valid.
Final Answer:
The filesystem_mirror path is incorrect or inaccessible -> Option A
Quick Check:
Invalid cache path causes downloads [OK]
Hint: Check cache path accessibility first [OK]
Common Mistakes:
Assuming Terraform lacks caching support
Ignoring filesystem permissions
Blaming missing provider version
5. You want to speed up Terraform runs in a team by caching providers locally but still allow direct downloads for some custom providers. Which configuration correctly achieves this?
hard
A.
provider_installation {
direct {
include = ["customcorp/custom"]
}
filesystem_mirror {
path = "/team/cache"
}
}