Skip to main content

Component Output Mocks

Declare literal outputs on a component and opt into using them for !terraform.state and !terraform.output lookups during local plans or configuration inspection.

Usage​

Declare mocks on the component that produces the outputs:

stacks/dev.yaml
components:
terraform:
vpc:
mocks:
vpc_id: vpc-local
private_subnet_ids: [subnet-a, subnet-b]
app:
vars:
vpc_id: !terraform.state vpc vpc_id
first_subnet: !terraform.output vpc '.private_subnet_ids[0]'

Enable mock lookups explicitly:

atmos describe component app -s dev --use-mocks
atmos terraform plan app -s dev --use-mocks

The lookups return vpc-local and subnet-a without accessing the VPC’s backend or initializing Terraform for that lookup. Running the app’s plan can still require its own provider credentials and infrastructure access.

Configuration Reference​

mocks
A map of output names to literal values on the producer component. Templates and YAML functions inside the map are not evaluated. The map follows component inheritance and deep merging.
--use-mocks
Opt-in flag for atmos terraform plan and atmos describe component; default false. YAML function processing must remain enabled. Other Terraform commands reject the flag.

Missing Outputs​

Missing mock maps or outputs produce errors rather than falling back to real state. An explicit YQ default can supply the missing value:

vars:
vpc_id: !terraform.state vpc '.vpc_id // "vpc-local"'

Without --use-mocks, lookups use their normal state/output source. This feature does not simulate providers or provision resources. See the component mocks example for a producer and consumer configuration.