# atmos packer source pull

Use this command to vendor a Packer component source based on its `source` configuration. This downloads the component from the specified URI and places it in the appropriate component directory.

**Source-Based Version Pinning**

Learn how to configure the `source` field for per-environment version control.

Design Pattern[Read more](/design-patterns/version-management/source-based-versioning)

## Usage

```shell
atmos packer source pull <component> --stack <stack> [flags]
```

## Description

The `pull` command vendors a Packer component source by:

1. Reading the `source` configuration from the component's stack manifest
2. Downloading the source from the specified URI using go-getter
3. Applying any `included_paths` and `excluded_paths` filters
4. Copying the filtered content to the component directory

If the component is already vendored, it will be skipped unless `--force` is specified.

## Examples

### Basic Usage

Vendor a component source for a specific stack:

```shell
atmos packer source pull ami-builder --stack dev
```

### Force Re-vendor

Re-vendor even if the component directory already exists:

```shell
atmos packer source pull ami-builder --stack dev --force
```

### With Identity Override

Use a specific identity for authentication:

```shell
atmos packer source pull ami-builder --stack dev --identity admin
```

## Arguments

- **`component`**
  **Required.**
   The name of the Atmos component to vendor.

## Flags

- **`--stack` / `-s`**
  **Required.**
   The Atmos stack name. Can also be set via 
  `ATMOS_STACK`
   environment variable.
- **`--force` / `-f`**
  Force re-vendor even if the component directory already exists. Without this flag, the command skips vendoring if the directory exists.
- **`--identity` / `-i`**
  Identity to use for authentication when downloading from protected sources. Overrides the component's default identity.

## Configuration

The component must have `source` configured in its stack manifest:

```yaml
components:
  packer:
    ami-builder:
      source:
        uri: github.com/cloudposse/packer-templates//ami-builder
        version: 1.0.0
        included_paths:
          - "*.pkr.hcl"
        excluded_paths:
          - "*.md"
          - "tests/**"
```

## Output

On success:

```
Vendoring component 'ami-builder' from source...
Downloading from github.com/cloudposse/packer-templates//ami-builder?ref=1.0.0
✓ Successfully vendored component to components/packer/ami-builder
```

## See Also

- [Source-Based Version Pinning](/design-patterns/version-management/source-based-versioning) — Design pattern for per-environment version control
- [`atmos packer source`](/cli/commands/packer/source) — Parent command overview
- [`atmos packer source describe`](/cli/commands/packer/source/describe) — View source configuration
- [`atmos packer source list`](/cli/commands/packer/source/list) — List components with source
- [`atmos packer source delete`](/cli/commands/packer/source/delete) — Remove vendored source
