0
0
Terraformcloud~5 mins

Provider versioning constraints in Terraform - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a provider version constraint in Terraform?
A provider version constraint tells Terraform which versions of a provider plugin it can use. It helps keep your infrastructure stable by avoiding unexpected changes from new provider versions.
Click to reveal answer
beginner
How do you specify a provider version constraint in Terraform?
You specify it inside the provider block using the 'version' argument, for example:
provider "aws" { version = "~> 4.0" }
This means Terraform will use any 4.x version starting from 4.0 but less than 5.0.
Click to reveal answer
intermediate
What does the version constraint '~> 3.5' mean?
It means Terraform can use any provider version from 3.5 up to, but not including, 4.0. So 3.5, 3.6, 3.9 are allowed, but 4.0 is not.
Click to reveal answer
beginner
Why is it important to use provider version constraints?
Using version constraints helps avoid breaking changes from new provider versions. It keeps your infrastructure predictable and stable, like locking a recipe so it doesn’t change unexpectedly.
Click to reveal answer
beginner
What happens if you don’t specify a provider version constraint?
Terraform will use the latest available provider version. This can cause unexpected changes or errors if the new version has different behavior or requirements.
Click to reveal answer
What does the version constraint '>= 2.0, < 3.0' mean in Terraform?
AUse any version less than 2.0
BUse only version 2.0
CUse any version greater than 3.0
DUse any provider version from 2.0 up to but not including 3.0
Which symbol in Terraform version constraints means 'compatible with'?
A~>
B>=
C<=
D==
Why should you avoid using no version constraint for providers?
AIt forces Terraform to use an old version
BIt can cause Terraform to use unstable or incompatible provider versions
CIt disables provider plugins
DIt makes Terraform run slower
How do you specify a provider version constraint for AWS provider version 4.x only?
Aversion = ">= 3.0"
Bversion = "< 4.0"
Cversion = "~> 4.0"
Dversion = "== 4.0"
What is the effect of the constraint 'version = ">= 1.0, < 2.0"'?
AAllows provider versions from 1.0 up to but not including 2.0
BAllows only version 1.0
CAllows any version greater than 2.0
DDisallows all versions
Explain why provider version constraints are important in Terraform and how they help maintain infrastructure stability.
Think about how recipes stay consistent when you lock ingredients.
You got /4 concepts.
    Describe how to write a version constraint in Terraform to allow any provider version from 2.5 up to but not including 3.0.
    Use comparison operators to set a range.
    You got /3 concepts.