From 7e3eff2e786e737fa29f664bf4547932caf23f41 Mon Sep 17 00:00:00 2001 From: Garison Draper Date: Fri, 3 Aug 2018 10:55:19 -0700 Subject: [PATCH 1/3] adding documentation for default lookup, missing when implmeneted in stacker since feb --- docs/lookups.rst | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/docs/lookups.rst b/docs/lookups.rst index 8c2327ebb..fd9586247 100644 --- a/docs/lookups.rst +++ b/docs/lookups.rst @@ -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 ``${ }`` syntax. If ```` isn't provided, the default of -``output`` will be used. +input>}`` syntax. If ```` isn't provided, stacker will +fall back to use the ``output`` lookup . Lookups are only resolved within `Variables `_. They can be nested in any part of a YAML @@ -58,6 +58,7 @@ dictionary:: stacker includes the following lookup types: - `output lookup`_ + - `default lookup`_ - `kms lookup`_ - `xref lookup`_ - `rxref lookup`_ @@ -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 +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:: + :: + +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 From e74f816d7c6ff1da500d176d45609763fe052f3f Mon Sep 17 00:00:00 2001 From: Garison Draper Date: Fri, 3 Aug 2018 13:32:30 -0700 Subject: [PATCH 2/3] modifying lang to be only support environment file --- docs/lookups.rst | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/docs/lookups.rst b/docs/lookups.rst index fd9586247..4e9a1002d 100644 --- a/docs/lookups.rst +++ b/docs/lookups.rst @@ -94,19 +94,28 @@ default Lookup -------------- The ``default`` lookup type will check if a value exists for the variable -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. +in the environment file, then fall back to a default defined in the stacker +config if the environment file 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:: :: 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. + +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. + +.. note:: + The ``default`` lookup only supports checking if a variable is defined in + An environment file. It does not support other embedded lookups to see + if they exist. Only variables in the environment file are supported. + If you attempt to have the default lookup perform any other lookup that + fails, stacker will throw an exception for that lookup and will stop your + build before it gets a chance to fall back to the default in your config. .. _`kms lookup`: From 3ebce19660b588b86195ae187ce873c89d8bceb4 Mon Sep 17 00:00:00 2001 From: Garison Draper Date: Fri, 3 Aug 2018 13:36:59 -0700 Subject: [PATCH 3/3] slight grammer fix --- docs/lookups.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/lookups.rst b/docs/lookups.rst index 4e9a1002d..279e0092e 100644 --- a/docs/lookups.rst +++ b/docs/lookups.rst @@ -111,8 +111,8 @@ value. .. note:: The ``default`` lookup only supports checking if a variable is defined in - An environment file. It does not support other embedded lookups to see - if they exist. Only variables in the environment file are supported. + an environment file. It does not support other embedded lookups to see + if they exist. Only checking variables in the environment file are supported. If you attempt to have the default lookup perform any other lookup that fails, stacker will throw an exception for that lookup and will stop your build before it gets a chance to fall back to the default in your config.