Component commands
Create reusable Microtica infrastructure components and scaffold them from a Git repo with the CLI, then instantiate them as environment resources.
The component commands manage components — the reusable infrastructure building blocks you instantiate as resources inside environments.
A component is a thin reference over a pipeline plus the build step (artifactStep) that produces its infrastructure artifact. The component's deployable versions are that pipeline's successful builds, so a component becomes usable once its pipeline has a successful build of the artifact step. Creating a component stores the reference — it doesn't build anything on its own.
All component commands need a project id. Pass --project <id> or set MICROTICA_PROJECT_ID.
List and inspect
component list
List the components in a project.
microtica component listid name type pipeline step
-------- -------- ---------- ------------- ----------
cmp-123 postgres database pg-s8z6jm BuildArtifactcomponent get
Show one component. Add --version <v> to pin a specific build; omit it for the latest.
microtica component get <componentId>Create a component
There are two ways to create a component: scaffold everything from a repo with init, or reference a pipeline you already have with create.
The three enum flags are shared by both commands:
| Flag | Allowed values |
|---|---|
--type <type> | kubernetes, database, storage, virtual-machine, lambda, vpc, other |
--iac-tool <tool> | terraform, cloudformation |
--cloud-provider <provider> | aws, azurerm, google |
component init
Scaffold a component end to end: create its pipeline from a repo, create the component referencing that pipeline, then trigger the first build. This is the quickest path from a repository to a deployable component.
microtica component init \
--name my-vpc \
--description "Networking VPC" \
--repo https://github.com/acme/infra-vpc \
--account <gitAccountId> \
--artifact-step BuildArtifact \
--type vpc --iac-tool terraform --cloud-provider aws \
--wait| Flag | Default | Description |
|---|---|---|
--name <name> | — | Component name (also the pipeline name). Required. |
--description <text> | — | Component description. Required. |
--repo <url> | — | Git repository URL. Required. |
--account <id> | — | Git account id. Required. |
--artifact-step <step> | — | Build step that produces the artifact. Required. |
--work-dir <path> | ./.microtica | Directory in the repo holding microtica.yaml. |
--spec-file <path> | — | Inline microtica.yaml. If omitted, the spec is read from the repo at build time. |
--branch-filter <regex> | — | Branches/tags to auto-trigger on. |
--var <key=value> | — | Pipeline environment variable. Repeatable. |
--automated-trigger | off | Trigger on repository events. |
--branch <ref> | main | Ref for the initial build. |
--wait | off | Follow the initial build until it finishes. |
--no-rollback | — | On failure, keep partially-created resources instead of deleting them. |
If any step fails, init rolls back what it created (deleting the component, then the pipeline) unless you pass --no-rollback.
component create
Create a component that references a pipeline you've already created.
microtica component create \
--name my-vpc \
--description "Networking VPC" \
--pipeline <pipelineId> \
--artifact-step BuildArtifact \
--type vpc --iac-tool terraform --cloud-provider aws| Flag | Description |
|---|---|
--name <name> | Component name. Required. |
--description <text> | Component description. Required. |
--pipeline <pipelineId> | Pipeline that builds the component. Required. |
--artifact-step <step> | Build step that produces the artifact. Required. |
Once the referenced pipeline has a successful build of the artifact step, add the component to an environment with env add-resource.