Skip to main content
2 min read

Module

Module

The stackgen module command sets tags on a custom module that is already in StackGen. To upload a module, use stackgen upload custom-modules.

Tags are key/value pairs. Governance expressions match them with module.tags["key"]. See Custom module tags.

Usage​

stackgen module [command]

Sub Commands​

tag​

Add, replace, or remove tags on every version of a module. <module> is a version id, or the module name passed to upload custom-modules as --name. When that name exists for more than one provider, pass --provider.

stackgen module tag <module> [flags]

Keys you pass are added or replaced. Other tags stay. Pass --remove-tag to drop a key. Pass --module-tag or --remove-tag.

Flags​

FlagDescription
--module-tag stringArrayModule tag as key=value (repeatable). Adds or replaces this key and keeps the module's other tags.
--provider stringProvider when <module> is a name shared by more than one provider. One of aws, gcp, azure, civo, oci, other.
--remove-tag stringArrayTag key to drop (repeatable). Other tags stay.
-h, --helpHelp for tag.

A pair without =, an empty value, and a repeated key fail before any request. A value may contain =. A comma stays in the value. Passing the same key to --module-tag and --remove-tag fails before any request.

See Global CLI flags for --interactive, --log, --output, --project, and --stackgen-home.

Examples

Add a tag and keep the others​

stackgen module tag my-module --provider aws \
--module-tag team=platform

The above command will set team=platform and leave the module's other tags in place.

Add several tags in one command​

Repeat --module-tag for each pair.

stackgen module tag my-module --provider aws \
--module-tag team=platform \
--module-tag env=prod \
--module-tag owner=infra

The above command will set team=platform, env=prod, and owner=infra, and leave the module's other tags in place.

Drop a tag​

stackgen module tag my-module --provider aws --remove-tag cost

The above command will remove the cost tag and leave the other tags in place.