Spec-Zone.ru › OpenTofu 1.12

fileexists Function

fileexists determines whether a file exists at a given path.

Code Block
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 OpenTofu 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​

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

Related Functions​

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

Copyright (c) The OpenTofu Authors
Copyright (c) 2014 HashiCorp, Inc.
Mozilla Public License, version 2.0
https://opentofu.org/docs/v1.12/language/functions/fileexists/

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API