{% set w_account = {"hax": ""} -%}
{% for key, secret in aomi_items.iteritems() -%}
{% set path_bits = key.split("_") -%}
{% set account = path_bits[0:path_bits|length - 2] -%}
{% set key = path_bits[path_bits|length - 2] -%}
{% if account != w_account.hax -%}
{% if w_account.update({"hax": account}) -%}# terrible hacks https://stackoverflow.com/questions/9486393/jinja2-change-the-value-of-a-variable-inside-a-loop{% endif -%}
[{{account|reject("equalto", "creds")|reject("equalto", "sts")|join("_")}}]
{% endif -%}
{% if key == "access" -%}
aws_access_key_id = {{secret}}
{% endif -%}
{% if key == "secret" -%}
aws_secret_access_key = {{secret}}
{% endif -%}
{% endfor -%}
