How do you keep Terraform module versions consistent across environments?

August 29, 2025 6 answers
Asked by hedge__clippers
I'm managing two EKS clusters—one for staging and the other for production—using Terraform alongside a co-worker. Recently, we decided to upgrade our staging cluster because Amazon Linux v2 support is being phased out. I updated the Terraform code and ran `terraform init -upgrade`, but that led to several issues during the `plan` stage. After some debugging and resetting back to the prior version, we discovered that while I had upgraded the AWS provider, the upgrade also changed the versions for several other modules since they weren't properly versioned. This resulted in us using different versions of the same modules, which is obviously problematic. How do you manage your provider and module versions to ensure consistency? Additionally, are there any tools similar to `composer` for PHP or `go mod` for Golang that can help with version management in Kubernetes?

Answers

!careful there+
If you're looking for something specific, you could try Updatecli. It's super useful for automating version updates across various file types, including Terraform modules. You can check it out at their official site.
Reply to this answer
revisit this
We tackle the versioning issue by pinning module versions for different environments and maintaining a module lock file to keep everyone aligned. Plus, we use tools like Renovate to automate PRs for version updates. This way, we can manage upgrades more smoothly without drift causing unexpected costs or issues.
Reply to this answer
_apricot preserves
You might find Terragrunt useful. It's designed to help manage Terraform, especially with keeping module versions consistent across environments. Definitely worth considering!
Reply to this answer
POTLUCK ROSTER
I usually avoid external modules to keep things simpler, but if you go that route, Renovate can still help manage updates for you. You can set hardcoded versions and let it track changes for approval and merging. If you want to use variables, check out Opentofu—it's worth looking into.
Reply to this answer
semicolon fan
I've heard great things about automation tools like Renovate CI and Updatecli for handling version updates automatically. They can check for version changes and create pull requests for you, plus they run basic CI tests to ensure that everything works smoothly before merging. This takes away the manual effort of version checking each week.
Reply to this answer
grammar page 26
Just a heads up, this issue is more about Terraform than Kubernetes specifically. You might want to ask over in a Terraform-focused community for more tailored advice!
Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions