lib/plugins/aws/utils/findReferences.js/findReferences
function findReferences(root, value) {
  const visitedObjects = [];
  const resourcePaths = [];
  const stack = [{ propValue: root, path: '' }];

  while (!_.isEmpty(stack)) {
    const property = stack.pop();

    _.forOwn(property.propValue, (propValue, key) => {
      let propKey;
      if (_.isArray(property.propValue)) {
        propKey = `[${key}]`;
      } else {
        propKey = _.isEmpty(property.path) ? `${key}` : `.${key}`;
      }
      if (propValue === value) {
        resourcePaths.push(`${property.path}${propKey}`);
      } else if (_.isObject(propValue)) {
        // Prevent circular references
        if (_.includes(visitedObjects, propValue)) {
          return;
        }
        visitedObjects.push(propValue);
        stack.push({ propValue, path: `${property.path}${propKey}` });
      }
    });
  }

  return resourcePaths;
}