!aws.cloudformation.output
The !aws.cloudformation.output YAML function reads the deployed
Outputs
of a native aws/cloudformation component directly in Atmos stack manifests,
by calling the CloudFormation DescribeStacks API. It is the Terraform↔CloudFormation
interop bridge: the sibling of !terraform.output,
but for aws/cloudformation targets instead of Terraform/OpenTofu ones.
Usage
The !aws.cloudformation.output function is called with either two or three parameters:
# Get the `output-key` Output of the `component` in the current stack
!aws.cloudformation.output <component> <output-key>
# Get the `output-key` Output of the `component` in the provided `stack`
!aws.cloudformation.output <component> <stack> <output-key>
Arguments
component- The
aws/cloudformationcomponent name. stack- (Optional) Atmos stack name. Defaults to the current stack when omitted.
output-keyThe exact CloudFormation Output's logical key (the value of the
Outputs.<key>entry in the target's template). Unlike!terraform.output, this is a direct lookup by key, not a YQ expression — CloudFormation Outputs are always a flat key/value map, so there is nothing to query into.
You can use Atmos Stack Manifest Templating in the !aws.cloudformation.output YAML function expressions.
Atmos processes the templates first, and then executes the !aws.cloudformation.output function, allowing you to provide the parameters to
the function dynamically.
Atmos supports type-aware merging of YAML functions and concrete values, allowing them to coexist in the inheritance chain without type conflicts. See the full explanation: YAML Function Merging
Requirements
- The target component must be a native
aws/cloudformationcomponent with a resolvedstack_name—!aws.cloudformation.outputerrors if the target has nostack_nameconfigured. - The target stack must already be deployed.
!aws.cloudformation.outputcalls the liveDescribeStacksAPI; there is no local-state equivalent (aws/cloudformationhas no Terraform/OpenTofu-style state file to read instead). - Resolving the function requires AWS authentication — it uses the target component's own auth if it authenticates independently, otherwise the enclosing component's (propagated from
--identity).
Examples
Caching the result of !aws.cloudformation.output function
Atmos caches (in memory) the results of the !aws.cloudformation.output function.
The cache is per Atmos CLI command execution, e.g., each new execution of a command like atmos terraform plan
or atmos describe component will create and use a new memory cache, re-invoking DescribeStacks on the next run.
If you define the function in stack manifests for the same component in a stack more than once, the first call will produce the result and cache it, and all the consecutive calls will just use the cached data.
Considerations
-
!aws.cloudformation.outputis not allowed inmetadata.tagsormetadata.labelsvalues — the same restriction as!terraform.output. Selectors (--tags/--labels) drive component-scoping decisions before evaluation, so they must be resolvable without authentication, API calls, or nondeterminism. -
Using
!aws.cloudformation.outputwith secrets can expose sensitive data to standard output (stdout) in any commands that describe stacks or components. -
Consider cold-start scenarios: if the dependent
aws/cloudformationstack has not yet been deployed, the function returns an error. -
Be mindful of disaster recovery (DR) implications when using it across regions.
See Also
!terraform.output— The Terraform/OpenTofu equivalentatmos.Component— The template-function equivalent, which also resolves.outputsforaws/cloudformationtargetsatmos aws cloudformation output— Show a deployed stack's Outputs from the CLI