Sha256: df38d424a1956adef9e6d0f7d525bdd3a1dd1ec795b92c65f5af07f0b89a7558

Contents?: true

Size: 1.18 KB

Versions: 3

Compression:

Stored size: 1.18 KB

Contents

# Variables

## Overview

You can create variables that are accessible in the `app/scripts` and `profiles` files.  You define the variables in the `config/variables/FORGER_ENV.rb` files.

## Structure

    config
    └── variables
        ├── base.rb
        ├── development.rb
        └── production.rb

## Variable Definitions

Examples of variables definitions:

config/variables/base.rb:

```ruby
@keypair = "my-keypair-1"
```

config/variables/development.rb:

```ruby
---
instance_type: t2.medium
key_name: default
max_count: 1
min_count: 1
security_group_ids: <%= @security_group_ids %>
subnet_id: <%= @subnets.shuffle.first %>
iam_instance_profile:
  name: IAMProfileName
```

## Variables Layering

The variable files are layered together.  The base.rb variable file always get evaulated. Then environment specific variables get evaluated according to the `FORGER_ENV` value. For example, `FORGER_ENV=development` results in `config/variables/development.rb` getting used.

## Accessing Variables

You access the variables files with ERB. Example:

profiles/server.yml:

```yaml
---
security_group_ids: <%= @security_group_ids %>
subnet_id: <%= @subnets.shuffle.first %>
```

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
forger-3.0.2 docs/variables.md
forger-3.0.1 docs/variables.md
forger-3.0.0 docs/variables.md