!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). - The target stack must hold deployed resources. A stack that only holds a preview changeset (
REVIEW_IN_PROGRESS, left behind bydifforplanon a component that was never applied) or that failed to create (ROLLBACK_COMPLETE,ROLLBACK_FAILED,CREATE_FAILED), or is being deleted (DELETE_*), is an error:stack "<name>" has status <status>. Apply the target component first. - The
output-keymust exist. A key the stack does not declare is an error that lists the keys it does have, instead of resolving tonull. A key that exists with an empty value is not an error. - 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
Output lookups
Atmos does not cache the result of the !aws.cloudformation.output function. Every evaluation of the
function calls DescribeStacks again, so each use in your manifests costs one API call, and the value
always reflects the deployed stack at that moment.
The atmos.Component template function resolves .outputs through
the same lookup and caches the component's sections for the duration of one Atmos command. Use it when
several values come from the same component and you want a single API call.
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 does not exist, or exists without deployed resources (for exampleREVIEW_IN_PROGRESSafter adiff), the function returns an error. A misspelledoutput-keyis an error too, so a typo cannot reach the consuming component as an empty value. -
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