# Consul-template spawns consul-template process problems/feedback

**URL:** <https://discuss.hashicorp.com/t/consul-template-spawns-consul-template-process-problems-feedback/18379>\
**Category:** Consul\
**Tags:** consul-template\
**Created:** [December 2, 2020, 6:43pm UTC](https://discuss.hashicorp.com/t/consul-template-spawns-consul-template-process-problems-feedback/18379 "2020-12-02T18:43:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![benmutlu](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/benmutlu/32/14595_2.png) [@benmutlu](https://discuss.hashicorp.com/u/benmutlu)\
**Post date:** [December 2, 2020, 6:43pm UTC](https://discuss.hashicorp.com/t/consul-template-spawns-consul-template-process-problems-feedback/18379/1 "2020-12-02T18:43:50Z")

</div>

Hi everyone,

I am trying to create consul-template which spawns consul-template process, I am doing that because I have 100+ dns zone files, and I want to use 1 DNS zone template and dynamically create destination zone files with it.

```
consul {
  address = "127.0.0.1:8500"
  retry {
    enabled = true
    attempts = 12
    backoff = "250ms"
  }
}
{{ define "zone_template" }}
    @ SOA ns1 hostmaster (
             5001 ; serial
             7200 ; refresh
             1800 ; retry
             604800 ; expire
             900 ; ncache
    )
    @ NS	ns1
    @ NS	ns2
    @ 7200 MX 10 mail
    MX 10 mail
    bla CNAME www
    {{ $content_endpoint := ("/zones/[domain_name]" | replaceAll "[domain_name]" .) }}
    {{with $domain_zones := key $content_endpoint | parseJSON}}
        {{range $domain_zones}}
            {{ .domain_prefix }} {{ .record_type }} {{ .address }}
        {{end}}
    {{end}}
{{ end }}
{{ with $main_domains := key "/main_domains" | parseJSON }}
    {{ range $main_domains }}
        {{ $destination_path := ("/config_service_orchestrator/template_tests//zones/[domain_name]" | replaceAll "[domain_name]" .domain_name) }}
        {{ $content_endpoint := ("/zones/[domain_name]" | replaceAll "[domain_name]" .domain_name) }}
        {{ $domain_name := .domain_name }}
        template {
          destination = "{{ $destination_path }}"
          contents = "{{ executeTemplate "zone_template" $domain_name }}"
          perms = 0600
          command = "./consul-template -config \"{{ $destination_path }}\""
        }
    {{ end }}
{{ end }}

```

I have template file and I am processing this template file from another template, at the end I successfully filled the template file, but I cannot trigger command line, is there any way or suggestion to passing value into template files ? Its kinda useless if cannot create multiple output file from single template file.

---

<div class="post-metadata">

**Author:** ![mccricardo](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/mccricardo/32/21652_2.png) [@mccricardo](https://discuss.hashicorp.com/u/mccricardo)\
**Post date:** [August 18, 2021, 11:20am UTC](https://discuss.hashicorp.com/t/consul-template-spawns-consul-template-process-problems-feedback/18379/2 "2021-08-18T11:20:19Z")

</div>

I only now noticed this is similar to the question I posted earlier today: [Reuse consul-template template](https://discuss.hashicorp.com/t/reuse-consul-template-template/28385)
