📒Sample Templates

Copy these samples into the CloudTruth Template editor

The samples include the relevant CloudTruth CLI command to fetch the template and assume the CloudTruth API key has been exported to an environment variable.

JSON

#
# Iterates through all parameters in the project
#
{
{%- for param in cloudtruth.parameters %}
  "{{param[0]}}": "{{param[1]}}"{%unless forloop.last%},{%endunless%}
{%- endfor %}
}
#
#
# Sample CloudTruth CLI command to fetch this template:
# Remove below after copying
#
# Assumes CloudTruth API key is exported to ENV variable
# 
cloudtruth --project {{cloudtruth.project}} template get "{{cloudtruth.self}}"

YAML

#
# Iterates through all parameters in the project
#
{%- for param in cloudtruth.parameters -%}
{{param[0]}}: {{param[1]}}
{% endfor -%}
}
#
#
# Sample CloudTruth CLI command to fetch this template:
# Remove below after copying
#
# Assumes CloudTruth API key is exported to ENV variable
# 
cloudtruth --project {{cloudtruth.project}} template get "{{cloudtruth.self}}"

ConfigMap

# 
# Sample ConfigMap template Kubetruth will fetch from the platform
#
{% assign params = cloudtruth.parameters | values | where: "secret", false -%}
{% assign version = cloudtruth.parameters | sort | to_json | sha256 | slice: 0, 7 -%}
{% if params.size > 0 -%}
kind: ConfigMap
metadata:
  name: "{{ cloudtruth.project }}"
  namespace: "{{ cloudtruth.environment }}"
  labels:
    version: "{{ version }}"
data:
  {%- for param in params %}
  {{ param.name | key_safe }}: |-
    {{ param.value }}
  {%- endfor %}
{% endif -%}

#
# Sample CloudTruth CLI command to fetch this template:
#
cloudtruth --project {{cloudtruth.project}} template get "{{cloudtruth.self}}"

ShellENV

#
# Iterates through all parameters in the project
#
{%- for param in cloudtruth.parameters %}
export {{param[0] | upcase}}="{{param[1]}}"
{%- endfor %}
#
#
# Sample CloudTruth CLI command to fetch this template:
#
cloudtruth --project {{cloudtruth.project}} template get "{{cloudtruth.self}}"y

TFVars

###
# Sample Liquid code to list all TF parameters for project {{cloudtruth.project}}
###
#
{%- for x in cloudtruth.parameters %}
TF_VAR_{{x[0]}}="{{x[1]}}"
{%- endfor %}
#
# Sample CloudTruth CLI command to fetch this template:
#
cloudtruth --project {{cloudtruth.project}} template get "{{cloudtruth.self}}"

Java Properties

#File Updated
# -
#{{ "now" | date: "%Y-%m-%d %H:%M" }}
#
#
{%- for param in cloudtruth.parameters -%}
{{param[0]}}={{param[1]}}
{% endfor -%}
#
# Sample CloudTruth CLI command to fetch this template:
#
cloudtruth --project {{cloudtruth.project}} template get "{{cloudtruth.self}}"

Last updated

Copyright© 2023 CloudTruth