Skip to content

Create a Component and Bundle ​

Learn how to scaffold a Component from an existing Terraform/OpenTofu module and use it inside a Bundle.

Prerequisites ​

  • A Terraform/OpenTofu module directory with variables

Steps ​

  1. Create a Component from a module
sh
cd path/to/module
terramate component create
  • Review generated component metadata and inputs.
  1. Define a Bundle that uses the Component

Create a new bundle definition directory and add a stack with a component instance:

hcl
define bundle stack "example" {
  metadata {
    path = "stacks/example"
    name = "Example Stack"
  }

  component "example" {
    source = "/components/path/to/created-component"
    inputs = {} # wire bundle inputs as needed
  }
}
  1. Scaffold and generate
sh
terramate scaffold
terramate generate

Next steps ​