Hello! Is templating supported with the usage file...
# help
e
Hello! Is templating supported with the usage files (e.g.
infracost-usage.yaml
)? Apologies if I missed this somewhere in the documentation.
Basically I want to be able to do something like (example in Jinja2):
Copy code
version: 0.1
resource_usage:
  google_storage_bucket.seq_workbooks:
    {%- set workbooks_per_project = 1 %}
    {%- set average_workbook_kb = 20 %}
    {%- set retention_months = 120 %}
    {%- set active_versions = 3 %}
    {%- set weekly_projects = 10 %}
    {%- set weekly_total_kb = weekly_projects * workbooks_per_project * average_workbook_kb * active_versions %}
    {%- set weekly_creation_operations = weekly_projects * 1 %}
    {%- set weekly_retrieval_operations = weekly_projects * 1 %}
    {%- set monthly_total_gb = weekly_total_kb * 4 * 1e-6 %}
    storage_gb: {{ monthly_total_gb * retention_months }}
    monthly_class_a_operations: {{ weekly_creation_operations * 4 }}
    monthly_class_b_operations: {{ weekly_retrieval_operations * 4 }}
a
Apologies, no. If you want to generate a usage file using templating, you could run it through any templating engine like jinja, mustache, bash-tpl, esh, etc. But that step has to be done prior to running the infracost runner and then pass the resulting usage file with the full template output
👍 1
e
Thank you Drew!