Add configenvv3 for etcdctl

Change-Id: I9cbd65c7ed260965420d120d2b89a646cb809939
Related-PROD: PROD-28771 (PROD:28771)
diff --git a/etcd/files/configenvv3 b/etcd/files/configenvv3
new file mode 100644
index 0000000..9f1811b
--- /dev/null
+++ b/etcd/files/configenvv3
@@ -0,0 +1,9 @@
+{%- from "etcd/map.jinja" import server with context %}
+# this file can be sourced and used to configure etcdctl
+export ETCDCTL_API=3
+export ETCDCTL_ENDPOINTS=["{% for member in server.members %}http{% if server.get('ssl', {}).get('enabled') %}s{% endif %}://{{ member.host }}:4001{% if not loop.last %},{% endif %}{% endfor %}"]
+{%- if server.get('ssl', {}).get('enabled') %}
+export ETCDCTL_CACERT=/var/lib/etcd/ca.pem
+export ETCDCTL_CERT=/var/lib/etcd/etcd-server.pem
+export ETCDCTL_KEY=/var/lib/etcd/etcd-server.key
+{% endif %}
diff --git a/etcd/server/service.sls b/etcd/server/service.sls
index 9390da3..67dcf45 100644
--- a/etcd/server/service.sls
+++ b/etcd/server/service.sls
@@ -186,6 +186,14 @@
     - require:
       - file: /var/lib/etcd/
 
+/var/lib/etcd/configenvv3:
+  file.managed:
+    - source: salt://etcd/files/configenvv3
+    - template: jinja
+    - user: etcd
+    - require:
+      - file: /var/lib/etcd/
+
 etcd:
   service.running:
   - enable: True