- v1.3.x (latest)
- v1.2.x
- v1.1 and earlier
- Overview
- Attributes as Blocks - Configuration Language
- Data Sources
- Overview
- abs
- abspath
- alltrue
- anytrue
- base64decode
- base64encode
- base64gzip
- base64sha256
- base64sha512
- basename
- bcrypt
- can
- ceil
- chomp
- chunklist
- cidrhost
- cidrnetmask
- cidrsubnet
- cidrsubnets
- coalesce
- coalescelist
- compact
- concat
- contains
- csvdecode
- dirname
- distinct
- element
- endswith
- file
- filebase64
- filebase64sha256
- filebase64sha512
- fileexists
- filemd5
- fileset
- filesha1
- filesha256
- filesha512
- flatten
- floor
- format
- formatdate
- formatlist
- indent
- index
- join
- jsondecode
- jsonencode
- keys
- length
- list
- log
- lookup
- lower
- map
- matchkeys
- max
- md5
- merge
- min
- nonsensitive
- one
- parseint
- pathexpand
- pow
- range
- regex
- regexall
- replace
- reverse
- rsadecrypt
- sensitive
- setintersection
- setproduct
- setsubtract
- setunion
- sha1
- sha256
- sha512
- signum
- slice
- sort
- split
- startswith
- strrev
- substr
- sum
- templatefile
- textdecodebase64
- textencodebase64
- timeadd
- timecmp
- timestamp
- title
- tobool
- tolist
- tomap
- tonumber
- toset
- tostring
- transpose
- trim
- trimprefix
- trimspace
- trimsuffix
- try
- type
- upper
- urlencode
- uuid
- uuidv5
- values
- yamldecode
- yamlencode
- zipmap
- Upgrading to Terraform v1.3
- v1.x Compatibility Promises
- Terraform Internals
- Intro to Terraform
- Configuration Language
- Terraform CLI
- Terraform Cloud
- Terraform Enterprise
- Provider Use
- Plugin Development
- Registry Publishing
- Integration Program
- Terraform Tools
- CDK for Terraform
- Glossary
Terraform Language
Other Docs
A new platform for documentation and tutorials is launching soon.
We are migrating Terraform documentation into HashiCorp Developer, our new developer experience.
»trimspace
Function
trimspace
removes any space characters from the start and end of the given
string.
This function follows the Unicode definition of "space", which includes regular spaces, tabs, newline characters, and various other space-like characters.
»Examples
> trimspace(" hello\n\n") hello
> trimspace(" hello\n\n")
hello
»Related Functions
chomp
removes just line ending characters from the end of a string.