Carina

export

Print export values from the current state. Exports are values declared in an exports block; they are also the values consumed by other projects via upstream_state.

Usage

carina export [OPTIONS] [NAME]

NAME is optional. When omitted, every export is printed. When set, only the named export is printed.

Without --state-url, Carina compares the configured backend with carina-backend.lock. While a backend migration is pending, export prints a warning to stderr and reads exports from the locked old backend. An explicit --state-url reads exactly the supplied URL instead.

Flags

--json

Output as JSON. With a NAME, prints that export’s value directly (for example, "vpc-audit"). Without a NAME, prints the full export map.

JSON export output is decoded for consumers: canonical enums are printed as their provider API strings, and user map keys beginning with $ keep their original spelling. The state file’s raw $enum payloads and $$ key escaping are not exposed by this command.

--raw

Output the raw value without the export name or surrounding quotes. Use a NAME with --raw. The CLI rejects an omitted name when exports exist; an empty export map prints No exports defined. and exits 0. Useful for piping a single export into another command.

--state-url <URL>

Read exports directly from a state URL without loading the current directory’s configuration. Accepts s3://bucket/key, file:///absolute/path, or a bare local path. The state file’s resource format may be newer than the running Carina as long as its exports encoding is supported.

Examples

Print every export:

carina export

Print a single export:

carina export vpc_id

Pipe a raw value into another tool:

aws ec2 describe-subnets --filters "Name=vpc-id,Values=$(carina export --raw vpc_id)"

Emit the full export map as JSON:

carina export --json

Read exports from another state file:

carina export --json --state-url s3://my-state-bucket/path/carina.state.json