Publish a Terraform Module
Convert an existing Terraform module into a Bluebricks package using the prepare and publish CLI workflow
Overview
Convert your existing Terraform module into a Bluebricks package in two steps: prepare locally, then publish to your organization.
Prerequisites
Bricks CLI installed and authenticated (
bricks login)Existing Terraform module with
.tffiles
How to publish a Terraform module
Prepare your module
Navigate to your Terraform directory and run:
cd /path/to/your-terraform-module
bricks blueprint prepare --source . --iac-type terraformThis creates a bricks.json with auto-detected variables and outputs. Your original .tf files remain in place.
Publish to your organization
bricks blueprint publishYour module is now available to your organization.
What each command does
bricks blueprint prepare generates a bricks.json in your current directory. No files are moved or copied, and no API calls are made. Your .tf files stay exactly where they are.
bricks blueprint publish uploads your package to Bluebricks. Variables and outputs are auto-discovered from your .tf files, external module references are resolved (if --resolve-modules is enabled), and the package is made available to your organization.
Working with existing modules
Local module references
If your Terraform uses local modules:
Bluebricks automatically handles this with --resolve-modules (enabled by default):
What happens:
Finds all modules referenced with
../Copies them to
bricks_modules/directoryUpdates references to point to
./bricks_modules/Includes everything in the published package
Your module becomes self-contained and portable.
Disable module resolution
If you don't want to include external modules:
Bluebricks warns you about external references but won't include them.
Terraform version
Default version: 1.5.7
Specify a different version in bricks.json:
For the full version limits table and examples, see version pinning.
State management
Bluebricks automatically manages state using its built-in HTTP backend. Do not include backend.tf or backend configuration blocks in your Terraform code.
For details on managed state, locking, and encryption, see Terraform/OpenTofu.
To work locally with remote state for debugging or development, see Develop Terraform Locally.
Publishing with existing state
If you're migrating existing Terraform infrastructure, include your state file:
Requirements:
Place
terraform.tfstatein your Terraform directoryBluebricks packages it with your module
State is stored securely in Bluebricks
Variables and outputs mapping
Variables and outputs are auto-discovered during publish. Bluebricks parses your variables.tf and outputs.tf, then converts them to props and outs in bricks.json. See Terraform/OpenTofu inputs and outputs for the full mapping details and examples.
Examples
Common options
Generated package structure
Best practices
Test locally before publishing
Use
--resolve-modulesfor portabilityInclude state with
--statewhen migrating existing infrastructureVersion your packages with semantic versioning
See also
Develop Terraform Locally: download state config for local debugging
Terraform/OpenTofu: artifact reference and features overview
Creating Blueprints: compose artifacts into blueprints
Packages: artifact types and packaging concepts
Last updated