Skip to content

Latest commit

 

History

History
34 lines (24 loc) · 873 Bytes

fileexists.mdx

File metadata and controls

34 lines (24 loc) · 873 Bytes
page_title description
fileexists - Functions - Configuration Language
The fileexists function determines whether a file exists at a given path.

fileexists Function

fileexists determines whether a file exists at a given path.

fileexists(path)

Functions are evaluated during configuration parsing rather than at apply time, so this function can only be used with files that are already present on disk before Terraform takes any actions.

This function works only with regular files. If used with a directory, FIFO, or other special mode, it will return an error.

Examples

> fileexists("${path.module}/hello.txt")
true
fileexists("custom-section.sh") ? file("custom-section.sh") : local.default_content

Related Functions

  • file reads the contents of a file at a given path