{{!
  Copyright (c) HashiCorp, Inc.
  SPDX-License-Identifier: BUSL-1.1
}}

{{#if (can "use partitions")}}
partition "{{or @partition 'default'}}" {
  {{#if (can 'use nspaces')}}
  namespace "{{or @nspace 'default'}}" {
    service "{{@name}}" {
	    policy = "write"
    }
    service "{{@name}}-sidecar-proxy" {
	    policy = "write"
    }
    service_prefix "" {
	    policy = "read"
    }
    node_prefix "" {
	    policy = "read"
    }
  }
  {{else}}
  service "{{@name}}" {
	  policy = "write"
  }
  service "{{@name}}-sidecar-proxy" {
	  policy = "write"
  }
  service_prefix "" {
	  policy = "read"
  }
  node_prefix "" {
	  policy = "read"
  }
  {{/if}}
}
{{else}}
{{#if (can 'use nspaces')}}
namespace "{{or @nspace 'default'}}" {
  service "{{@name}}" {
	  policy = "write"
  }
  service "{{@name}}-sidecar-proxy" {
	  policy = "write"
  }
  service_prefix "" {
	  policy = "read"
  }
  node_prefix "" {
	  policy = "read"
  }
}
{{else}}
service "{{@name}}" {
	policy = "write"
}
service "{{@name}}-sidecar-proxy" {
	policy = "write"
}
service_prefix "" {
	policy = "read"
}
node_prefix "" {
	policy = "read"
}
{{/if}}
{{/if}}