Skip to content
atmos-functions logo

Cross-Component Dependencies with Atmos Functions

atmos-functions

**Preferred approach: Atmos Functions** - Use Atmos template functions in stack YAML to pass values between components at plan/apply time. This avoids Terraform remote state lookups entirely.

SKILL.md

Full skill instructions

Cross-Component Dependencies with Atmos Functions

Preferred approach: Atmos Functions - Use Atmos template functions in stack YAML to pass values between components at plan/​apply time. This avoids Terraform remote state lookups entirely.

!terraform.state Syntax

Two-parameter form (current stack):

!terraform.state <component> <output>

Three-parameter form (specific stack):

!terraform.state <component> <stack> <output>

Examples

components:
  terraform:
    my-component:
      vars:
        # Current stack lookups (component output)
        vpc_id: !terraform.state vpc vpc_id
        subnet_ids: !terraform.state vpc private_subnet_ids

        # Cross-stack lookup (component stack output)
        grafana_role_arn: !terraform.state grafana core-use2-auto workspace_iam_role_arn

        # Nested output with YQ expression
        role_arn: !terraform.state iam-role/​my-role plat-use2-dev .role.arn

!terraform.output Alternative

There's also !terraform.output which has the same syntax but different behavior:

# Same syntax as !terraform.state
vpc_id: !terraform.output vpc vpc_id

Key differences:

Aspect!terraform.state (preferred)!terraform.output
How it worksReads directly from S3 state bucketRuns terraform init + terraform output
SpeedFast (direct S3 read)Slow (full Terraform initialization)
Use caseDefault choiceWhen state file format differs

Always prefer !terraform.state - it's significantly faster because it reads the state file directly from S3 without running Terraform commands.

Best Practices

  • Use !terraform.state over !terraform.output - Direct S3 access is much faster than running Terraform.
  • Define lookups in catalog defaults - Put !terraform.state expressions in stacks/​catalog/<component>/​defaults.yaml rather than in stack files. The function automatically resolves based on the current stack context.
  • Use current-stack lookups when possible - Omit the stack parameter to look up components in the same stack, making configs more portable.
  • Cross-stack lookups for shared resources - Use the three-parameter form when referencing centralized resources (e.g., Grafana in core-auto from plat accounts).

Legacy Approach (Being Phased Out)

Some older components still use Cloud Posse's remote-state Terraform module with remote-state.tf files. This pattern is being phased out in favor of Atmos functions. The tfstate backend is in the core-auto account.

When you encounter remote-state.tf files, prefer converting them to !terraform.state expressions in the catalog.

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View