Links
Comment on page
📒

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

1
#
2
# Iterates through all parameters in the project
3
#
4
{
5
{%- for param in cloudtruth.parameters %}
6
"{{param[0]}}": "{{param[1]}}"
7
{%- endfor %}
8
}
9
#
10
#
11
# Sample CloudTruth CLI command to fetch this template:
12
# Remove below after copying
13
#
14
# Assumes CloudTruth API key is exported to ENV variable
15
#
16
cloudtruth --project {{cloudtruth.project}} template get "{{cloudtruth.self}}"

YAML

1
#
2
# Iterates through all parameters in the project
3
#
4
{%- for param in cloudtruth.parameters -%}
5
{{param[0]}}: {{param[1]}}
6
{% endfor -%}
7
}
8
#
9
#
10
# Sample CloudTruth CLI command to fetch this template:
11
# Remove below after copying
12
#
13
# Assumes CloudTruth API key is exported to ENV variable
14
#
15
cloudtruth --project {{cloudtruth.project}} template get "{{cloudtruth.self}}"

ConfigMap

1
#
2
# Sample ConfigMap template Kubetruth will fetch from the platform
3
#
4
{% assign params = cloudtruth.parameters | values | where: "secret", false -%}
5
{% assign version = cloudtruth.parameters | sort | to_json | sha256 | slice: 0, 7 -%}
6
{% if params.size > 0 -%}
7
kind: ConfigMap
8
metadata:
9
name: "{{ cloudtruth.project }}"
10
namespace: "{{ cloudtruth.environment }}"
11
labels:
12
version: "{{ version }}"
13
data:
14
{%- for param in params %}
15
{{ param.name | key_safe }}: |-
16
{{ param.value }}
17
{%- endfor %}
18
{% endif -%}
19
20
#
21
# Sample CloudTruth CLI command to fetch this template:
22
#
23
cloudtruth --project {{cloudtruth.project}} template get "{{cloudtruth.self}}"

ShellENV

1
#
2
# Iterates through all parameters in the project
3
#
4
{%- for param in cloudtruth.parameters %}
5
export {{param[0] | upcase}}="{{param[1]}}"
6
{%- endfor %}
7
#
8
#
9
# Sample CloudTruth CLI command to fetch this template:
10
#
11
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}}"
va
Copyright© 2023 CloudTruth