The sharing_backend block β
Use the sharing_backend block to configure a backend that enables outputs sharing between stacks. The sharing_backend block binds input and output blocks and defines how stack outputs are collected and distributed.
INFO
Outputs Sharing is an experimental feature. To use this block, enable the experiment in your Terramate configuration:
terramate {
config {
experiments = ["outputs-sharing"]
}
}Arguments β
label (required) - A name for this sharing backend, referenced by
inputandoutputblocks.type(required, keyword) - The type of backend. Currently onlyterraformis supported (also works with OpenTofu).filename(required, string) - The filename used to generate the input and output code (e.g., Terraformvariableandoutputblocks).command(required, list of strings) - The command invoked to extract stack outputs. The command output must be a JSON object.
Syntax β
sharing_backend "default" {
type = terraform
filename = "sharing_generated.tf"
command = ["terraform", "output", "-json"]
}Examples β
Share outputs between Terraform stacks β
sharing_backend "default" {
type = terraform
filename = "sharing_generated.tf"
command = ["terraform", "output", "-json"]
}Share outputs between OpenTofu stacks β
sharing_backend "tofu" {
type = terraform
filename = "sharing_generated.tf"
command = ["tofu", "output", "-json"]
}