0
0
Terraformcloud~5 mins

Module versioning in Terraform - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is module versioning in Terraform?
Module versioning in Terraform means keeping track of different versions of a module so you can use a specific, stable version in your infrastructure code.
Click to reveal answer
beginner
Why should you use versioned modules in Terraform?
Using versioned modules helps avoid unexpected changes by locking your infrastructure to a tested module version, making your deployments more reliable.
Click to reveal answer
beginner
How do you specify a module version in Terraform?
You specify a module version by adding a version argument in the module block, like: <br>module "example" {<br> source = "registry.terraform.io/hashicorp/example"<br> version = "1.2.0"<br>}
Click to reveal answer
intermediate
What happens if you don’t specify a module version?
If you don’t specify a version, Terraform uses the latest available module version, which might cause unexpected changes if the module updates.
Click to reveal answer
intermediate
How can you update a module to a newer version safely?
To update safely, change the version number in your module block, run terraform init -upgrade to download the new version, then test your infrastructure.
Click to reveal answer
What is the purpose of specifying a module version in Terraform?
ATo lock the module to a specific stable version
BTo automatically upgrade to the latest module version
CTo delete old versions of the module
DTo run the module faster
Which command updates Terraform modules to the latest allowed version?
Aterraform destroy
Bterraform apply
Cterraform plan
Dterraform init -upgrade
What happens if you omit the version argument in a Terraform module source?
ATerraform uses the latest module version
BTerraform throws an error
CTerraform uses a random module version
DTerraform disables the module
Why is it risky to always use the latest module version without specifying a version?
AIt disables module caching
BIt makes Terraform run slower
CIt can cause unexpected infrastructure changes
DIt deletes your state file
How do you specify a module version in Terraform code?
Asource_version = "1.0.0" inside the provider block
Bversion = "1.0.0" inside the module block
Cmodule_version = "1.0.0" outside the module block
Dversion = "latest" inside the resource block
Explain what module versioning is in Terraform and why it is important.
Think about how using a fixed version helps keep your infrastructure predictable.
You got /3 concepts.
    Describe the steps to safely update a Terraform module to a newer version.
    Consider how you control the version and apply the update carefully.
    You got /3 concepts.