Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Optional include statement #599

@thomasfinstad

Description

@thomasfinstad

What problem are you facing?

Includes causes the execution to fail if the file doesn't exist.
Forcing either empty files where they are not needed, or custom templates for each situation.

This is especially annoying in a recursive setup with submodules where the template is only defined at the top level in .terraform-docs.yaml

How could terraform-docs help solve your problem?

An include statement that checks for the file first and skips it if it is missing.

Suggestions for syntax:

{{ optional_include "examples/example-1/main.tf" }}
{{ include_nofail "examples/example-1/main.tf" }}
{{ include "?examples/example-1/main.tf" }}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions