This repository has been archived on 2026-01-10. You can view files and clone it, but cannot push or open issues or pull requests.
coder-templates/_app.tf.j2
Steve McMaster d8b020c4e0
Some checks failed
continuous-integration/drone/push Build is failing
Add _app generic and use it for thug template
2025-04-16 14:01:52 -04:00

112 lines
2.7 KiB
Django/Jinja

{% extends "base.tf.j2" %}
{% block parameters %}
{{ super() }}
{% if coder_parameters %}
{% for param in coder_parameters %}
data "coder_parameter" "{{ param.name }}" {
name = "{{ param.display_name | default(param.name) }}"
ephemeral = {{ param.ephemeral | default("false", true) }}
mutable = {{ param.mutable | default("true", true) }}
type = "{{ param.type | default("string")}}"
{% if param.default %}
default = "{{ param.default }}"
{% endif %}
{% if param.description %}
description = "{{ param.description }}"
{% endif %}
{% if param.display_name %}
display_name = "{{ param.display_name }}"
{% endif %}
{% if param.form_type %}
form_type = "{{ param.form_type }}"
{% endif %}
{% if param.icon %}
icon = "{{ param.icon }}"
{% endif %}
{% if param.order %}
order = {{ param.order }}
{% endif %}
{% if param.styling %}
styling = "{{ param.styling }}"
{% endif %}
{% for option in param.options %}
option {
{% if hasattr(option, "items") %}
name = "{{ option.name }}"
value = "{{ option.value | default(option.name) }}"
{% if option.description %}
description = "{{ option.description }}"
{% endif %}
{% if option.icon %}
icon = "{{ option.icon }}"
{% endif %}
{% else %}
name = "{{ option }}"
value = "{{ option }}"
{% endif %}
}
{% endfor %}
{% if param.validation %}
{% endif %}
}
{% endfor %}
{% endif %}
{% endblock %}
{% block coder_apps %}
{% if coder_apps %}
{% for app in coder_apps %}
resource "coder_app" "jupyter" {
agent_id = coder_agent.main.id
display_name = {{ app.display_name }}
slug = {{ app.slug }}
icon = {{ app.icon }}
url = {{ app.url }}
subdomain = true
share = "owner"
{% if app.healthcheck %}
healthcheck {
url = {{ app.healthcheck.url }}
interval = {{ app.healthcheck.interval | default(3) }}
threshold = {{ app.healthcheck.threshold | default (10) }}
}
{% endif %}
}
{% endfor %}
{% endif %}
{% endblock %}
{% block kubernetes_pod_extra_env %}
{% if envvars %}
{% for envvar in envvars %}
env {
name = "{{ envvar.name | upper() }}"
value = "{{ envvar.value }}"
}
{{ super() }}
{% endblock %}
{% block kubernetes_pod_main_volume_mount %}
{% if main_volume_mount_path %}
volume_mount {
mount_path = "{{ main_volume_mount_path }}"
name = "home"
read_only = false
}
{% else %}
{{ super() }}
{% endif %}
{% endblock %}
{% block post_startup_script_setup_home %}
{% if startup_script %}
{{ startup_script }}
{% endif %}
{% endblock %}