Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation update: Adding Default Lookup to official docs #636

Merged
merged 3 commits into from
Aug 4, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions docs/lookups.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ concept called lookups. A lookup is meant to take a value and convert
it by calling out to another service or system.

A lookup is denoted in the config with the ``${<lookup type> <lookup
input>}`` syntax. If ``<lookup type>`` isn't provided, the default of
``output`` will be used.
input>}`` syntax. If ``<lookup type>`` isn't provided, stacker will
fall back to use the ``output`` lookup .

Lookups are only resolved within `Variables
<terminology.html#variables>`_. They can be nested in any part of a YAML
Expand Down Expand Up @@ -58,6 +58,7 @@ dictionary::
stacker includes the following lookup types:

- `output lookup`_
- `default lookup`_
- `kms lookup`_
- `xref lookup`_
- `rxref lookup`_
Expand Down Expand Up @@ -86,6 +87,27 @@ You can specify an output lookup with the following syntax::

ConfVariable: ${output someStack::SomeOutput}


.. _`default lookup`:

default Lookup
--------------

The ``default`` lookup type will check if a value exists for the variable
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't 100% true, right? It can also be used to give default variables to lookups.

${default ${output MyVpc::VpcId}::vpc-123456}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I... hadn't, really thought of that. It's an interesting idea. I didn't write the lookup module, so let me dig into it to check if that would work. (Or @troyready could chime in, since he wrote it)

in the environment, then fall back to a default defined in the stacker
config if the environment doesn't contain the variable. This allows defaults
to be set at the config file level, while granting the user the ability
to override that value per environment.

Format of value::
<env_var>::<default value>

For example::
Groups: ${default app_security_groups::sg-12345,sg-67890}
If `app_security_groups` is defined in the environment file, its defined
value will be returned. Otherwise, `sg-12345,sg-67890` will be the returned
value.

.. _`kms lookup`:

KMS Lookup
Expand Down