Error AtlasError Documentation and Resolution

Terraform could not convert the value to number

Error: Invalid function argument

Terraform could not convert the supplied value to a number because tonumber only accepts numbers, null, or strings containing decimal numeric text.

Invalid function argumentconfiguration
Error: Invalid function argument
  • The expression passes a non-numeric string such as no or abc to tonumber.
  • The function receives a collection or incompatible type instead of a number-like value.
  • Input normalization assumes Terraform can parse values that are not decimal numbers.
  1. Check the exact value passed into tonumber and ensure it is numeric text or an existing number.
  2. Normalize input variables earlier if they can arrive in multiple formats.
  3. Avoid using tonumber on values that may contain non-numeric text without prior validation.
tonumber function
Terraform Invalid function argument with tonumber: causes and fixes | Error Atlas