Terraform 1.8 Released with Provider Functions
HashiCorp has released Terraform 1.8, introducing provider-defined functions — the most significant language enhancement since Terraform 1.0. This release also includes improved refactoring support and state management improvements.
Provider-Defined Functions
Providers can now expose custom functions callable directly in HCL configuration. The AWS provider, for example, offers functions for ARN parsing and CIDR calculations:
```hcl locals { account_id = provider::aws::arn_parse(var.role_arn).account_id subnets = provider::aws::cidr_subnets("10.0.0.0/16", 8, 8, 8, 8) } ```
This eliminates the need for external data sources or complex regex patterns that were previously required for common operations.
Improved Refactoring with Removed Block
The new `removed` block allows declaring that a resource has been removed from Terraform management without destroying it:
```hcl removed { from = aws_instance.legacy_server lifecycle { destroy = false } } ```
State Management
Terraform 1.8 improves state file handling for large configurations, reducing plan times by up to 40 percent for configurations managing thousands of resources.
Upgrade Path
Terraform 1.8 is backward compatible with 1.x configurations. The state file format has not changed, so upgrades are safe to perform in place. Review your lock file after upgrading to ensure provider versions are compatible.
Terraform 1.8 is a recommended upgrade for all teams using Terraform, with no breaking changes and meaningful developer experience improvements.
Want to learn more?
Get in touch with our team to discuss how we can help your infrastructure.