# atmos packer init

Use this command to initialize Packer and install plugins according to an HCL template configuration for an Atmos component in a stack.

## Usage

Execute the `packer init` command like this:

```shell
atmos packer init <component> --stack <stack> [flags] -- [packer-options]
```

:::tip
For more details on the `packer init` command and options, refer to [Packer init command reference](https://developer.hashicorp.com/packer/docs/commands/init).
:::

## Arguments

- **`component` (required)**

  Atmos Packer component.

## Flags

- **`--stack` (alias `-s`)(required)**

  Atmos stack.
- **`--template` (alias `-t`)(optional)**

  Packer template.
  It can be specified in the `settings.packer.template` section in the Atmos component manifest,
  or on the command line via the flag `--template <template>` (shorthand `-t`).
  The command line flag takes precedence over `settings.packer.template`.

## Examples

```shell
atmos packer init aws/bastion --stack nonprod
atmos packer init aws/bastion -s prod --template main.pkr.hcl
atmos packer init aws/bastion -s nonprod -t main.nonprod.pkr.hcl
```

```shell
> atmos packer init aws/bastion --stack nonprod

Installed plugin github.com/hashicorp/amazon v1.3.9 in "~/.config/packer/plugins/github.com/hashicorp/amazon/packer-plugin-amazon_v1.3.9_x5.0_darwin_arm64"
```
