Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/mcamacho97/terraform-mean-stack-aws/llms.txt

Use this file to discover all available pages before exploring further.

Terraform outputs capture the key values you need to access and manage the deployed MEAN stack infrastructure. They are printed to the terminal at the end of every successful terraform apply run and can be retrieved at any time thereafter without re-running a plan or apply. Outputs are sourced from module return values — each group of resources (network, compute, load balancer, keypair) exposes its identifiers upward to the root module, which re-exports them as the named outputs documented here.

Accessing Outputs

# Print all outputs
terraform output

# Get a specific output value
terraform output alb_dns_name

# Get raw value (no quotes, useful in scripts)
terraform output -raw alb_dns_name

# Get all outputs as JSON
terraform output -json
Use terraform output -json | jq to parse outputs programmatically in CI/CD pipelines. For example, terraform output -json | jq -r '.alb_dns_name.value' extracts just the ALB hostname with no extra formatting.

Network

vpc_id
string
The ID of the provisioned VPC. Use this value when creating additional resources outside of Terraform that need to be attached to the same network, or when troubleshooting VPC-level routing in the AWS Console.Example value: vpc-0abc123def456789a

Node 1

node_1_public_ip
string
Public IPv4 address of Node.js Server 1. This instance sits in Public Subnet A (availability_zone_1) and is registered as a target behind the Application Load Balancer. Use this address for direct SSH access when you need to inspect logs, run deployment scripts, or use Node 1 as a jump host into the private subnet.Example value: 54.210.100.1
node_1_private_ip
string
Private IPv4 address of Node.js Server 1 within the VPC. Used for inter-service communication — for example, when configuring the MongoDB connection string on the Node 1 host to reach the database in the private subnet.Example value: 10.0.1.50

Node 2

node_2_public_ip
string
Public IPv4 address of Node.js Server 2. This instance sits in Public Subnet B (availability_zone_2), providing cross-AZ redundancy alongside Node 1. Use this address for direct SSH access to the second application server.Example value: 54.210.100.2
node_2_private_ip
string
Private IPv4 address of Node.js Server 2 within the VPC. Referenced when diagnosing traffic distribution between the two Node instances or configuring intra-VPC communication.Example value: 10.0.2.50

MongoDB

mongodb_private_ip
string
Private IPv4 address of the MongoDB instance. The MongoDB server is deployed exclusively in the private subnet — it has no public IP address and no inbound internet access. To connect, use one of the Node.js instances as a jump host (see the SSH examples below) or use AWS Systems Manager Session Manager if configured.Example value: 10.0.3.100

Load Balancer

alb_dns_name
string
DNS hostname of the Application Load Balancer. This is the primary entry point for all HTTP traffic to your application — share this address with users or point a custom domain’s CNAME record at it. The ALB distributes requests across both Node.js instances and performs health checks to route away from unhealthy targets.Example value: terraform-mean-alb-1234567890.us-east-1.elb.amazonaws.com

NAT Gateway

nat_gateway_public_ip
string
The Elastic IP address associated with the NAT Gateway. All outbound internet traffic from the private subnet (including MongoDB’s OS updates and package downloads) exits through this IP. If you need to allowlist outbound traffic from your private subnet in a third-party firewall or service, this is the IP to use.Example value: 34.205.200.10

SSH Key

private_key_path
string
Filesystem path to the auto-generated PEM private key file. The key pair is created by the keypair module using the Terraform TLS provider and written to the local keys/ directory at apply time. Pass this path to ssh -i to authenticate to both Node instances.Example value: keys/terraform-mean.pem

Practical Usage Examples


State and Output Recovery

Outputs are stored in Terraform state (terraform.tfstate or in your S3 backend) — they are not written to any external file. If you lose access to state, you can attempt to recover output values by running terraform refresh while the underlying infrastructure still exists. Terraform will re-read the live resource attributes from AWS and repopulate the state file.

Build docs developers (and LLMs) love