# atmos terraform generate varfile

Use this command to generate a `.tfvar.json` variable file for an Atmos [component](/components) in a [stack](/stacks) with all configured values.

## Usage

Execute the `terraform generate varfile` command like this:

```shell
atmos terraform generate varfile <component> -s <stack>
```

This command generates a varfile for an Atmos terraform component in a stack.

:::tip
Run `atmos terraform generate varfile --help` to see all the available options
:::

## Examples

```shell
atmos terraform generate varfile top-level-component1 -s tenant1-ue2-dev
atmos terraform generate varfile infra/vpc -s tenant1-ue2-staging
atmos terraform generate varfile test/test-component -s tenant1-ue2-dev
atmos terraform generate varfile test/test-component-override-2 -s tenant2-ue2-prod
atmos terraform generate varfile test/test-component-override-3 -s tenant1-ue2-dev -f vars.json
```

## Arguments

- **`component` (required)**

  Atmos terraform component.

## Flags

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

  Atmos stack.
- **`--dry-run` (optional)**

  Dry run.
  ```shell
  atmos terraform generate varfile <component> -s <stack> --dry-run=true
  ```
- **`--process-templates` (optional)**

  Enable/disable Go template processing in Atmos stack manifests when executing terraform commands.

  If the flag is not passed, template processing is enabled by default.
  ```shell
  atmos terraform generate varfile <component> -s <stack> --process-templates=false
  ```
- **`--process-functions` (optional)**

  Enable/disable YAML functions processing in Atmos stack manifestswhen executing terraform commands.

  If the flag is not passed, YAML function processing is enabled by default.
  ```shell
  atmos terraform generate varfile <component> -s <stack> --process-functions=false
  ```
- **`--skip` (optional)**

  Skip processing a specific Atmos YAML function in Atmos stacks manifests when executing terraform commands.

  To specify more than one function, use multiple `--skip` flags, or separate the functions with a comma.
  ```shell
  atmos terraform generate varfile <component> -s <stack> --skip=eval --skip=include
  atmos terraform generate varfile <component> -s <stack> --skip=terraform.output,include
  ```
- **`--with-secrets` (optional)**

  Write resolved secret values into the generated varfile. **Disabled by default** so
  plaintext secrets never hit disk.

  By default, any variable whose value contains a [secret](/cli/configuration/secrets) is
  omitted from the generated varfile (Atmos warns you when this happens). Pass
  `--with-secrets` only when you deliberately need a complete varfile containing the
  decrypted values (for example, to hand it off to another tool) — and treat the resulting
  file as sensitive.

  Can also be set via the `ATMOS_WITH_SECRETS` environment variable.
  ```shell
  atmos terraform generate varfile <component> -s <stack> --with-secrets
  ```
