diff --git a/CATALYST.md b/CATALYST.md index 1290dc5..01d1ff2 100644 --- a/CATALYST.md +++ b/CATALYST.md @@ -589,6 +589,34 @@ define component input "name" { # Catalyst Functions +## tm_source(relative_path) + +This function can be used inside of components code generation. + +It should be used referencing relative path to e.g. Terraform modules. + +At code generation this relative path defined in the components context will be translated into a relativ path based on the stack the code will generated in. + +If component, bundle and referenced path ae all local, the generated path in the stack will be relative pointing to the correct module location within the repository. + +If the references are remote, the remote referenced path will be adjusted accordingly. + +The folling code inside of a component describes how to reference a module in the parent directory. + +```hcl +generate_hcl "main.tf" { + content { + module "my-module" { + source = tm_source("..") # reference a module in the parent directory + + # ... input variables + } + } +} +``` + +When referencing remote modules, this function is not required and can be omitted. + ## tm_bundles(class) and tm_bundle(class, alias) To access information of instantiated bundles we provide two functions: