Vendor URL Syntax
Atmos vendor sources support a wide variety of URL schemes and path formats for pulling external components, stacks, and configurations. Understanding the URL syntax helps you effectively vendor dependencies from any source.
URL Schemes
Atmos vendoring is built on HashiCorp's go-getter library, with additional support for OCI registries and smart defaults for Git hosting platforms.
Supported Schemes
| Scheme | Description | Example |
|---|---|---|
(no scheme) | Implicit HTTPS for Git hosts | github.com/owner/repo.git?ref=v1.0 |
https:// | HTTPS protocol | https://github.com/owner/repo.git//path?ref=v1.0 |
git:: | Explicit Git protocol | git::https://github.com/owner/repo.git?ref=v1.0 |
oci:// | OCI registries (Atmos extension) | oci://ghcr.io/owner/image:tag |
file:// | Local filesystem | file:///absolute/path/to/components |
ssh:// | SSH protocol | ssh://git@github.com/owner/repo.git |
| SCP-style | SSH shorthand | git@github.com:owner/repo.git |
Most of the time, you can use the simplest form without an explicit scheme. Atmos will automatically detect the right protocol.
Subdirectory Syntax
One of the most powerful features is the subdirectory delimiter that lets you vendor only a specific directory from a repository.
The Double-Slash Delimiter
The double-slash (//) is a special delimiter (not a path separator) that separates:
- Left side: The source to download (repository URL, archive, etc.)
- Right side: The subdirectory within that source to extract
- With Subdirectory
- Root Directory
- Without Delimiter
source: "github.com/cloudposse-terraform-components/aws-vpc.git//modules/public-subnets?ref=1.398.0"
Result: Clones the repository and extracts only the modules/public-subnets subdirectory.
source: "github.com/cloudposse-terraform-components/aws-s3-bucket.git//.?ref=v5.7.0"
Result: Clones the repository and uses the root directory (. means current directory).
source: "github.com/cloudposse-terraform-components/aws-vpc.git?ref=v1.0"
Result: For Git URLs without a subdirectory, Atmos automatically adds //. for you (root of repository).
Common Patterns
| Pattern | What It Means | When To Use |
|---|---|---|
repo.git//path/to/dir | Extract path/to/dir subdirectory | When you only need a specific directory |
repo.git//. | Extract root directory | When you need the entire repository |
repo.git | No subdirectory specified | Atmos adds //. automatically for Git URLs |
The triple-slash pattern (///) was used in older Atmos versions to indicate the root directory:
# Old syntax (still works but deprecated)
source: "github.com/owner/repo.git///?ref=v1.0"
# New syntax (explicit and clear)
source: "github.com/owner/repo.git//.?ref=v1.0"
Atmos automatically normalizes the triple-slash pattern for backward compatibility, but we recommend using //. for clarity.
Query Parameters
Query parameters are appended to the URL and control how the source is downloaded.
Common Parameters
| Parameter | Description | Example |
|---|---|---|
ref=<value> | Git reference (branch, tag, commit) | ?ref=main or ?ref=v1.0.0 |
depth=<n> | Git clone depth (shallow clone) | ?depth=1 |
sshkey=<path> | Path to SSH private key | ?sshkey=~/.ssh/id_rsa |
Atmos automatically adds depth=1 to Git clones for faster downloads. You can override this by explicitly setting depth.
Examples
- Git Tag
- Git Branch
- Git Commit SHA
- Custom Clone Depth
source: "github.com/cloudposse-terraform-components/aws-vpc.git?ref=v1.398.0"
source: "github.com/cloudposse/atmos.git//examples?ref=main"
source: "github.com/cloudposse-terraform-components/aws-vpc.git?ref=a1b2c3d4"
source: "github.com/cloudposse-terraform-components/aws-vpc.git?ref=main&depth=10"
URL Patterns by Platform
- GitHub
- GitLab
- Bitbucket
- Azure DevOps
- Self-Hosted Git
- OCI Registries
Implicit HTTPS (recommended)
# Simple - implicit HTTPS, root directory
source: "github.com/cloudposse-terraform-components/aws-vpc.git?ref=v1.398.0"
With Subdirectory
# Clone and extract specific subdirectory
source: "github.com/cloudposse-terraform-components/aws-vpc.git//modules/public-subnets?ref=v1.398.0"
Explicit git:: Protocol
# Explicit git protocol
source: "git::https://github.com/cloudposse/atmos.git//examples?ref=main"
SSH Authentication
# SSH protocol (requires SSH key setup)
source: "git::ssh://git@github.com/cloudposse-terraform-components/aws-vpc.git?ref=v1.0.0"
# Or SCP-style shorthand
source: "git@github.com:cloudposse-terraform-components/aws-vpc.git?ref=v1.0.0"
With Credentials (Not Recommended)
# HTTPS with embedded credentials (not recommended, use tokens)
source: "https://user:password@github.com/owner/repo.git?ref=v1.0"
Atmos automatically injects GitHub tokens from ATMOS_GITHUB_TOKEN or GITHUB_TOKEN environment variables. No need to embed credentials in URLs!
Implicit HTTPS
# Simple - implicit HTTPS
source: "gitlab.com/group/project.git?ref=v1.0.0"
With Subdirectory
# Extract specific directory
source: "gitlab.com/group/project.git//terraform/modules?ref=main"
Set ATMOS_GITLAB_TOKEN or GITLAB_TOKEN for automatic authentication.
Implicit HTTPS
# Simple - implicit HTTPS
source: "bitbucket.org/owner/repo.git?ref=main"
With Subdirectory
# Extract specific directory
source: "bitbucket.org/owner/repo.git//infrastructure?ref=main"
Set ATMOS_BITBUCKET_TOKEN or BITBUCKET_TOKEN for automatic authentication.
Azure DevOps Repositories
# Azure DevOps Git repositories
source: "dev.azure.com/organization/project/_git/repository//path?ref=main"
Self-Hosted Git Servers
# Any self-hosted Git server
source: "git.company.com/team/repository.git//modules?ref=v1.0.0"
# With explicit HTTPS
source: "https://git.company.com/team/repository.git?ref=v1.0.0"
Atmos supports pulling artifacts from OCI-compatible registries like GitHub Container Registry (ghcr.io), AWS ECR, Google Artifact Registry, and more.
OCI Syntax
source: "oci://<registry>/<namespace>/<image>:<tag>"
GitHub Container Registry
source: "oci://ghcr.io/cloudposse/components/vpc:v1.0.0"
AWS ECR Public
source: "oci://public.ecr.aws/cloudposse/components/terraform/stable/aws/vpc:latest"
Docker Hub
source: "oci://docker.io/library/nginx:alpine"
Atmos uses the following precedence order for OCI registry authentication:
- Docker credentials (highest precedence) - Credentials from
docker loginstored in~/.docker/config.json - Environment variables - For GitHub Container Registry (ghcr.io):
- Token:
ATMOS_GITHUB_TOKENorGITHUB_TOKEN - Username:
ATMOS_GITHUB_USERNAME,GITHUB_ACTOR, orGITHUB_USERNAME
- Token:
- Anonymous - Fallback for public images
Examples:
# Method 1: Authenticate with Docker (works for any registry)
docker login ghcr.io -u YOUR_USERNAME
# Enter your token when prompted
# Method 2: Use environment variables for GHCR
export GITHUB_TOKEN=ghp_your_token
export GITHUB_ACTOR=your_username # Or ATMOS_GITHUB_USERNAME
# Method 3: GitHub Actions (automatic)
# GITHUB_TOKEN and GITHUB_ACTOR are automatically available
Important GHCR Requirements:
- GitHub Container Registry requires both a username and token for authentication
- Username must be your actual GitHub username (not
x-access-token) - Without a username, authentication will fail even if token is set
- In GitHub Actions,
GITHUB_ACTORis automatically set to the workflow actor's username
User Docker credentials always take precedence over environment variable tokens.
Local Paths
Relative Paths
# Relative to vendor.yaml location
source: "../../../components/terraform/mixins"
Absolute Paths
# Absolute filesystem path
source: "/absolute/path/to/components"
file:// URI
# file:// URI (gets converted to absolute path)
source: "file:///path/to/local/components"
Atmos validates local paths to prevent directory traversal attacks. Paths with .. are carefully validated.
HTTP/HTTPS Downloads
Archive Files
# Download and extract archives
source: "https://example.com/components.tar.gz"
source: "https://example.com/components.zip"
Single Files
# Download a single file
source: "https://raw.githubusercontent.com/cloudposse/terraform-null-label/0.25.0/exports/context.tf"
Template Variables
Atmos supports Go templates in vendor URLs for dynamic configuration.