Skip to content

Sensitive Data & local.env

The upstream demo repository uses a local.env file for account-specific configuration. This page explains how to manage sensitive values and avoid committing them to version control.

The local.env file in the Upstream_Demo_Repo stores environment-specific values that Terraform needs but should never appear in committed source code:

VariablePurposeExample placeholder
SHARED_SERVICES_ACCOUNT_ID12-digit AWS account ID for the provider account123456789012
DEV_ACCOUNT_ID12-digit AWS account ID for the consumer account987654321098
SHARED_SERVICES_PROFILEAWS CLI profile name for the provider accountshared-services
DEV_PROFILEAWS CLI profile name for the consumer accountdev

Copy local.env.example to local.env and replace placeholder values with your real account IDs and profile names before running Terraform.

The upstream repository excludes local.env from version control via .gitignore:

local.env

This prevents accidental commits of real account IDs. The walkthrough site uses Placeholder_ID values (123456789012, 987654321098) in all code blocks, command examples, and output samples.

Contributors must distinguish safe placeholders from real identifiers:

TypeSafe placeholder (commit OK)Real value (never commit)
Account ID123456789012Your organization’s 12-digit account number
Account ID987654321098A second real account number
ARNarn:aws:iam::123456789012:role/EXAMPLE-RoleAn ARN containing your real account ID
DNSvpce-EXAMPLE.ap-southeast-2.vpce.amazonaws.comA live VPC endpoint DNS name from your account
Credentials(not shown — use placeholders only)Access key ID, secret access key, session token

The quality gate scans fenced code blocks and rejects any 12-digit number not in the approved allow-list, any ARN with a non-allowlisted account ID, and AWS DNS patterns that are not documented placeholders.

Terminal window
# Safe placeholder values for documentation
SHARED_SERVICES_ACCOUNT_ID=123456789012
DEV_ACCOUNT_ID=987654321098
SHARED_SERVICES_PROFILE=shared-services
DEV_PROFILE=dev

A real local.env on your workstation would contain your organization’s account IDs instead of 123456789012 and 987654321098. Never paste real values into documentation, pull requests, or chat.

If real account IDs, credentials, or other sensitive values are accidentally committed:

  1. Rotate immediately — deactivate exposed access keys, invalidate SSO sessions, and rotate any secrets that appeared in the commit
  2. Remove from history — use git filter-repo or BFG Repo-Cleaner to purge the sensitive data from all commits, then force-push the cleaned branch (coordinate with your team first)
  3. Verify .gitignore — confirm local.env and any other sensitive files are listed in .gitignore
  4. Re-run the quality gate — ensure npm run build passes with placeholder values only
  5. Audit access — review CloudTrail and IAM logs for unauthorized activity during the exposure window