Bring your own modules
Upload and publish Facets modules you wrote with the Praxis CLI, register their output types, and optionally create a project type that limits projects to them.
Modules you write load the same way as catalog ones: upload each one with raptor create iac-module, then publish it. A project type is optional. Create one when a team's projects should use only your modules.
For Facets' own modules, see Load modules from the catalog. To write a module, see Manually using Raptor.
Upload and publish a module
A module folder holds the Terraform, a facets.yaml that names the module (intent, flavor, version) and sets its contract, a variables.tf and an outputs.tf. Publishing also needs a README.md with some text.
# Run every check without uploading
raptor create iac-module -f ./modules/secure-bucket --dry-run
# Upload it as a preview. --auto-create registers its type if the control plane doesn't have it
raptor create iac-module -f ./modules/secure-bucket --auto-create
# Publish it, by the name in its facets.yaml
raptor publish iac-module aws-s3-bucket/secure-bucket/1.0A preview is usable only in test projects. Publishing makes it usable in other projects too. To do both in one step, add --publish to the upload.
The upload runs the same checks as raptor module validate, on your machine, so Terraform needs to be installed:
| Check | What it looks at |
|---|---|
| Scope | The output types the module's inputs and outputs use exist on the control plane |
| Schema | facets.yaml, its spec and its sample |
| Inputs | variables.tf against facets.yaml |
| Outputs | outputs.tf against the output types it declares |
| Terraform | No provider blocks, then terraform fmt, init and validate |
| Security | A Trivy scan for high and critical findings, when Trivy is installed |
When the folder is inside a Git repository, the upload also records the repository URL and commit it came from. raptor get iac-module TYPE/FLAVOR/VERSION --history shows it.
Register your own output types
If your modules use output types the control plane doesn't have, register them before the modules that use them:
# A folder of definitions, one file per type, each named by its "name" field
raptor create output-type -f ./outputs --if-absent
# Or a single type
raptor create output-type @custom/my-output -f my-output.yamlAn output type is shared by every module that uses it, and has no preview stage. A change to one applies to all of those modules at once.
Upload several modules at once
raptor create iac-module --source ./modules --auto-create \
--module aws-s3-bucket/secure-bucket/1.0 --module OTHER_TYPE/FLAVOR/VERSION--source is a folder that holds the modules, and each --module names one by TYPE/FLAVOR/VERSION. Every module needs a README.md. Raptor checks the whole list first, including that each output type exists and offers the providers the modules ask for. If a check fails, nothing is uploaded. Publish each module afterwards.
Your own project type
A project type with no module list lets its projects use every published module. To keep a team's projects to your modules, create a project type that lists them. Each module has to be published first:
raptor create project-type internal-platform --description "Internal platform modules" \
--resource-type aws-s3-bucket/secure-bucket --resource-type service/aws
# Add or remove modules later
raptor create resource-type-mapping internal-platform --resource-type postgres/aws-rds
raptor delete resource-type-mapping internal-platform --resource-type service/aws
# See what it allows
raptor get resource-type-mappings internal-platformA project type created with the Praxis CLI starts its projects from an empty blueprint. It uses OpenTofu unless you pass --iac-tool TERRAFORM.
To base a project type on an existing project or a Git repository, create it in the console (Creating a project type).
Moving from a project-type YAML
raptor import project-type -f project-type.yml is turned off, and raptor no longer reads project-type YAML files. To carry one over:
| In the YAML or the old command | Now |
|---|---|
name and description | raptor create project-type NAME --description TEXT |
modules:, a list of intent and flavor | One --resource-type INTENT/FLAVOR for each entry, after the module is published |
allowedClouds | --cloud AWS, repeated for each cloud |
iacTool and iacToolVersion | --iac-tool and --iac-tool-version |
gitUrl, gitRef and baseTemplatePath, a starting blueprint | No CLI equivalent. Use Custom Git Linking in the console |
--modules-dir and --outputs-dir | raptor create iac-module for each module, and raptor create output-type -f for the outputs folder |
Troubleshooting
Intent <name> not found on upload
The control plane doesn't have the module's type yet. Upload again with --auto-create.
Output @namespace/name not found on upload
An output type the module uses isn't registered. Register it with raptor create output-type, then upload again.
uploaded preview is missing a non-empty README.md on publish
Add a README.md with some text to the module's folder, upload it again, then publish.
required output type ... does not expose provider ... when uploading several modules
A module asks for a provider through an input or output, and that output type's definition doesn't list the provider. Add it to the output type's providers and register the type again.
Module validation fails with Terraform errors
- Check the Terraform syntax in the failing module.
- Make sure all required variables are present.
- Run
raptor module validate -f <module-folder>to see every check without uploading. - Upload without the local checks if you need to. The publishing checks still apply:
raptor create iac-module -f /path/to/module --skip-validation
Module conflicts with a built-in Facets module
Cannot update Facets built-in module with intent network and flavor aws_vpc.
Please choose a different flavor.Use a different flavor name in your module's facets.yaml:
intent: network
flavor: aws_vpc_custom # Changed from aws_vpc
version: 1.0Output type creation fails
- Make sure your module has proper
output_interfacesandoutput_attributesinoutputs.tf. - Validate the schema file without creating anything:
raptor create output-type @custom/my-output -f output-schema.yaml --dry-run
Command reference
# Check, upload and publish one module
raptor create iac-module -f <MODULE_DIR> --dry-run
raptor create iac-module -f <MODULE_DIR> [--auto-create] [--publish]
raptor publish iac-module <TYPE/FLAVOR/VERSION>
# Upload several modules from one folder
raptor create iac-module --source <DIR> --module <TYPE/FLAVOR/VERSION> [--module <TYPE/FLAVOR/VERSION> ...]
# Register output types, from a folder or one file
raptor create output-type -f <DIR> [--if-absent]
raptor create output-type <@NAMESPACE/NAME> -f <FILE>
# Project types and the modules they allow
raptor create project-type <NAME> --description <TEXT> [--resource-type <TYPE/FLAVOR> ...]
raptor create resource-type-mapping <PROJECT_TYPE> --resource-type <TYPE/FLAVOR>
raptor delete resource-type-mapping <PROJECT_TYPE> --resource-type <TYPE/FLAVOR>
raptor get resource-type-mappings <PROJECT_TYPE>Run any command with --help for all its flags.
FAQ
Do I need a project type?
Not to load modules. Every project needs one, and a project type with no module list allows every published module.
Do I need to upload modules every time?
No. Upload a module again only when it changes. Publishing a changed module whose version is already published needs --backward-compatible yes. A breaking change needs a new version and --versionupgrade.
Can a project use modules uploaded for another team?
Yes. Modules are registered across the control plane. A project can use any published module its project type allows.
What if my module has custom dependencies?
Specify all Terraform dependencies in your module's Terraform configuration. Validation runs terraform init, which fetches the required providers and modules.
Load modules from the catalog
Load modules from Facets' catalog with the Praxis CLI: register their output types, upload the modules you pick, and publish them. A project type is optional.
Creating a project type
Create a project type in the console (from a project, another project type or a Git repository), with the Praxis CLI, or by asking a Praxis agent.