terraform-upgrade-assistant
Terraform Upgrade Assistant
This skill helps safely upgrade Terraform and provider versions.
When to Use
Use this skill when:
- Upgrading Terraform CLI version
- Updating provider versions
- Fixing deprecated syntax warnings
- Migrating to new provider features
- Preparing for major version upgrades
Upgrade Process
1. Check Current Versions
# Check Terraform version
terraform version
# Check provider versions in use
terraform providers
# Check for available updates
terraform init -upgrade
2. Review Upgrade Guides
Before upgrading, review:
- Terraform Upgrade Guides
- Provider changelog (e.g., AWS provider releases)
- Breaking changes documentation
3. Upgrade Strategy
Incremental approach (recommended):
- Upgrade one minor version at a time
- Test thoroughly between upgrades
- Fix deprecation warnings before major upgrades
Example path: 1.0 → 1.1 → 1.2 → 1.3 → 1.4 → 1.5
4. Update Version Constraints
# 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"
}
}
}
Handling Deprecation Warnings
Identify Warnings
# Run plan to see warnings
terraform plan
# Example output:
# Warning: Argument is deprecated
# Use aws_s3_bucket_acl resource instead
Upgrade Checklist
Pre-Upgrade
- Backup state file
- Review upgrade guides for target version
- Check provider changelogs
- Test in non-production environment first
- Ensure team is aware of upgrade
During Upgrade
- Update version constraints in code
- Run
terraform init -upgrade - Run
terraform planand review changes - Fix any deprecation warnings
- Update CI/CD pipelines with new version
Post-Upgrade
- Run
terraform plan(should show no changes) - Test apply in dev environment
- Update documentation
- Commit version constraint changes
- Monitor for issues
Troubleshooting
State File Compatibility
# If state file is incompatible with provider source
terraform state replace-provider \
registry.terraform.io/-/aws \
registry.terraform.io/hashicorp/aws
Provider Plugin Issues
# Clear provider cache and reinitialize
rm -rf .terraform/
rm .terraform.lock.hcl
terraform init -upgrade
Version Constraint Best Practices
# 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
More from armanzeroeight/fastagent-plugins
gcp-cost-optimizer
Analyzes GCP costs and provides optimization recommendations including committed use discounts, rightsizing, and unused resources. Use when optimizing GCP spending or analyzing GCP costs.
15kubernetes-best-practices
Provides production-ready Kubernetes manifest guidance including resource management, security, high availability, and configuration best practices. This skill should be used when working with Kubernetes YAML files, deployments, pods, services, or when users mention k8s, container orchestration, or cloud-native applications.
11schema-designer
Design database schemas with proper normalization, relationships, constraints, and indexes. Use when creating database tables, modeling data relationships, or designing database structure.
11api-documentation-generator
Generate OpenAPI/Swagger specifications and API documentation from code or design. Use when creating API docs, generating OpenAPI specs, or documenting REST APIs.
9goroutine-patterns
Implement Go concurrency patterns using goroutines, channels, and synchronization primitives. Use when building concurrent systems, implementing parallelism, or managing goroutine lifecycles. Trigger words include "goroutine", "channel", "concurrent", "parallel", "sync", "context".
9inventory-manager
Organizes Ansible inventory files, manages host groups, and configures dynamic inventory. Use when organizing Ansible inventory, managing host groups, or setting up dynamic inventory sources.
9