in terranova/commands/binds.py [0:0]
def validate(path: str | None, fail_at_end: bool) -> None:
"""Check whether the configuration is valid."""
# Find all resources manifests
paths = resource_dirs(path)
# Store errors if fail_at_end
errors = False
# Format all paths
for full_path, rel_path in paths:
Log.action(f"Validating: {rel_path}")
# Mount terraform context
terraform = mount_context(full_path)
discover_resources(full_path)
message = f"validate resources at `{full_path.as_posix()}`."
# Format resources files
try:
terraform.validate()
Log.success(message)
except InvalidResourcesError:
errors = True
Log.failure(message)
if not fail_at_end:
break
# Report any errors if fail_at_end has been enabled
if errors:
Log.fatal(
"The syntax is probably incorrect in one of the projects. See above for errors."
)