How to fix Error: Call to unknown function - There is no function named in Terraform

TerraformINTERMEDIATEMEDIUMUpdated Dec 30, 2025ยท 110 views

This error occurs when Terraform encounters a function name it doesn't recognize. Common causes include version mismatches, deprecated functions, or using Terragrunt functions in Terraform code.

Quick fix

Fixes Error: Call to unknown function - There is no function named

terraform version
  1. Check your Terraform version
  2. Check the required Terraform version in your configuration
  3. Upgrade Terraform to the required version
  4. Check for deprecated or renamed functions
terraform โ€” error
terraform version
Error: Call to unknown function - There is no function named

What this error means

Terraform and Terragrunt have built-in functions that can be used in HCL expressions. When you reference a function that doesn't exist in your current version of Terraform or Terragrunt, this error is raised. This typically happens in three scenarios: 1. **Version Mismatch**: You're using a newer function in an older version of Terraform that doesn't support it yet. 2. **Deprecated Functions**: You're using a function that existed in an older version but was removed or renamed (e.g., `defaults` was removed in Terraform 1.3). 3. **Tool Mismatch**: You're using a Terragrunt-specific function in Terraform code, or vice versa. The error message will specify which function is unknown, making it easier to troubleshoot.

Typical symptoms

  • Terraform init, plan, or apply fails with an error message listing the unknown function
  • Module from a newer Terraform version fails when used with an older version
  • Terraform configuration works locally but fails in CI/CD with a different Terraform version
  • Terragrunt runs locally but encounters function errors in a different environment

Common causes

  1. Terraform version is older than the version required by your module or code that uses newer functions
  2. Using a function that was removed or renamed between Terraform versions (e.g., defaults function removed in 1.3)
  3. Using Terragrunt HCL functions in regular Terraform code, or vice versa
  4. Typo in the function name or incorrect function syntax

How to fix "Error: Call to unknown function - There is no function named"

1Check your Terraform version

Run the following command to see which version of Terraform you have installed:

bash
terraform version

Note the version number. Most commonly, this error occurs when your installed Terraform version is older than what your configuration requires.

2Check the required Terraform version in your configuration

Look for a terraform block in your configuration (usually in main.tf or a separate version file):

hcl
terraform {
  required_version = ">= 1.3"
}

If the required version is higher than what you have installed, that's your issue. Also check for required_providers blocks that might have version constraints.

3Upgrade Terraform to the required version

If your installed version is older than required, upgrade Terraform:

On macOS (with Homebrew):

bash
brew upgrade terraform

On Linux or manual installation:
1. Visit https://www.terraform.io/downloads.html
2. Download the appropriate binary for your system
3. Extract and move it to your PATH (e.g., /usr/local/bin)

Verify the upgrade:

bash
terraform version
4Check for deprecated or renamed functions

If you're upgrading Terraform, check the release notes for function changes. For example, in Terraform 1.3, the defaults function was removed.

Common deprecated functions:
- defaults() - removed in Terraform 1.3, use optional() with default values instead
- get_parent_tfvars_dir() - renamed to get_parent_terragrunt_dir() in Terragrunt 0.19+

Search your configuration for any functions matching the error message and check the Terraform documentation at https://developer.hashicorp.com/terraform/language/functions for the correct function name and syntax.

5Verify you're not mixing Terraform and Terragrunt functions

If you're using both Terraform and Terragrunt:

In regular Terraform files (.tf), use only Terraform built-in functions like:
- file(), filebase64(), jsonencode(), merge(), concat(), etc.

In Terragrunt files (terragrunt.hcl), you can use both Terraform functions AND Terragrunt-specific functions like:
- get_terragrunt_dir(), get_parent_terragrunt_dir(), path_relative_to_include(), etc.

If you're getting an unknown function error in a .tf file, make sure you're not using Terragrunt-specific functions there.

6Clear Terraform cache and reinitialize

After upgrading or fixing function references, reinitialize Terraform:

bash
# Remove the .terraform directory
rm -rf .terraform/

# Reinitialize Terraform
terraform init

Then retry your terraform plan or terraform apply command.

Advanced notes

Terragrunt vs Terraform Functions: Terragrunt wraps Terraform and adds its own HCL functions. In Terraform 0.15.3+, Terragrunt's custom functions are managed separately from Terraform's built-in functions. When you reference a function in Terragrunt configuration, it looks in Terragrunt's function set first.

Version Constraints: You can use Terragrunt's hcl() function to conditionally execute code based on Terraform version:

hcl
dynamic "feature" {
  for_each = strcontains(local.tf_version, "1.3") ? [1] : []
  content {
    # Use v1.3+ functions here
  }
}

Provider Functions: Starting with Terraform 1.8, cloud providers can define custom functions (e.g., AWS provider functions). These are called with the syntax provider::<PROVIDER>::<FUNCTION>(). Ensure you have the correct provider version installed to use these functions.

Frequently asked questions

What does "Error: Call to unknown function - There is no function named" mean?
Terraform and Terragrunt have built-in functions that can be used in HCL expressions. When you reference a function that doesn't exist in your current version of Terraform or Terragrunt, this error is raised. This typically happens in three scenarios: 1.
How do I fix "Error: Call to unknown function - There is no function named"?
This error occurs when Terraform encounters a function name it doesn't recognize. Common causes include version mismatches, deprecated functions, or using Terragrunt functions in Terraform code.
What causes "Error: Call to unknown function - There is no function named"?
Terraform version is older than the version required by your module or code that uses newer functions Using a function that was removed or renamed between Terraform versions (e.g., defaults function removed in 1.3) Using Terragrunt HCL functions in regular Terraform code, or vice versa
Is the "Error: Call to unknown function - There is no function named" error serious?
It is a medium-severity error โ€” more of a blocker than a risk. The steps above resolve it.

Official resources & further reading