Guides through Terraform version upgrades including identifying deprecated syntax, updating provider versions, and migrating breaking changes.
This skill helps safely upgrade Terraform and provider versions.
Use this skill when:
# Check Terraform version
terraform version
# Check provider versions in use
terraform providers
# Check for available updates
terraform init -upgrade
Before upgrading, review:
Incremental approach (recommended):
Example path: 1.0 → 1.1 → 1.2 → 1.3 → 1.4 → 1.5
# Before
terraform {
required_version = ">= 1.0"
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 4.0"
}
}
}
# After
terraform {
required_version = ">= 1.5"
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}
}
# Run plan to see warnings
terraform plan
# Example output:
# Warning: Argument is deprecated
# Use aws_s3_bucket_acl resource instead
terraform init -upgradeterraform plan and review changesterraform plan (should show no changes)# If state file is incompatible with provider source
terraform state replace-provider \
registry.terraform.io/-/aws \
registry.terraform.io/hashicorp/aws
# Clear provider cache and reinitialize
rm -rf .terraform/
rm .terraform.lock.hcl
terraform init -upgrade
# Good - Allows patch updates, prevents breaking changes
terraform {
required_version = "~> 1.5.0" # 1.5.x only
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0" # 5.x only
}
}
}
# Too restrictive
required_version = "= 1.5.0" # Only exact version
# Too permissive
required_version = ">= 1.0" # Could break on major updates