/changelogs/terraform/terraform-1-5-to-1-16
Terraform 1.5 to 1.16: import, removed and check blocks, and what else changed
verified onenvironmentlocal · windows 10.0.26200 arm64 · GNU bash 5.3.15 (Git Bash) · Terraform v1.16.6updated 2026-10-20
- tool
- Terraform
- versions
- 1.5 → 1.16
Terraform 1.x keeps backward compatibility for configurations, so most upgrades within 1.x need no code changes. What changed since 1.5 is mainly new language blocks that move one-off CLI state surgery into reviewed code.
New blocks by version
| Version | Feature | Replaces |
|---|---|---|
| 1.1 | moved { from, to } | terraform state mv |
| 1.4 | terraform_data built-in resource | null_resource from the null provider |
| 1.5 | import { to, id } and plan -generate-config-out | terraform import |
| 1.5 | check { assert { … } } for continuous validation | external smoke tests |
| 1.6 | terraform test with .tftest.hcl files | third-party test frameworks for modules |
| 1.7 | removed { from; lifecycle { destroy = false } } | terraform state rm |
| 1.10 | ephemeral resources and values that never reach the state | secrets stored in state |
All of them in one configuration
cat > main.tf <<'EOF'
resource "terraform_data" "app" {
input = "v1"
}
moved {
from = terraform_data.old
to = terraform_data.app
}
removed {
from = terraform_data.legacy
lifecycle {
destroy = false
}
}
check "input_is_set" {
assert {
condition = terraform_data.app.input != ""
error_message = "input must not be empty"
}
}
import {
to = terraform_data.imported
id = "abc"
}
resource "terraform_data" "imported" {}
EOF
terraform init -input=false -no-color >/dev/null
terraform version | head -1
terraform validate -no-color
terraform plan -no-color -input=false | grep '^Plan:'Output
Terraform v1.16.6 Success! The configuration is valid. Plan: 1 to import, 1 to add, 0 to change, 0 to destroy.
Upgrade checklist
- Read the "UPGRADE NOTES" sections of the changelog for each minor version you skip.
- Raise
required_versionin shared modules only when they use a new feature. - Run
terraform init -upgradeandterraform planwith the new version; the plan should show no changes. - Commit
.terraform.lock.hclso every machine uses the same providers.
Sources
- developer.hashicorp.comdeveloper.hashicorp.com/terraform/language/import
- developer.hashicorp.comdeveloper.hashicorp.com/terraform/language/resources/syntax#removing-resources
- developer.hashicorp.comdeveloper.hashicorp.com/terraform/language/checks
- github.comgithub.com/hashicorp/terraform/blob/main/CHANGELOG.md
Related pages
cheat sheets · terraformTerraform cheat sheet: init, plan, apply, state and workspacesTerraform cheat sheet: init and upgrade, fmt and validate, plan and apply, outputs, state list, mv and rm, import, workspaces, and common language syntax.compat · terraformTerraform version constraints: ~>, >=, != and required_versionHow Terraform version constraints match: ~> 1.15 allows 1.15 up to but not 2.0, ~> 1.15.0 only 1.15.x. Tested against Terraform 1.16.6 with required_version.glossary · terraformWhat is Terraform state?Terraform state is the JSON record that maps each resource address in your code to the real object it manages and its last known attributes: terraform.tfstate.