diff --git a/_modules/heatv1/__init__.py b/_modules/heatv1/__init__.py
new file mode 100644
index 0000000..51d90b4
--- /dev/null
+++ b/_modules/heatv1/__init__.py
@@ -0,0 +1,38 @@
+"""
+Module for handling Heat stacks.
+
+:depends:   - os_client_config
+:configuration: This module is not usable until the following are specified
+"""
+
+try:
+    import os_client_config
+    REQUIREMENTS_MET = True
+except ImportError:
+    REQUIREMENTS_MET = False
+
+import os
+import sys
+
+# i failed to load module witjout this
+# seems bugs in salt or it is only me
+sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
+
+import stack
+
+stack_create = stack.stack_create
+stack_delete = stack.stack_delete
+stack_list = stack.stack_list
+stack_show = stack.stack_show
+stack_update = stack.stack_update
+
+__all__ = ('stack_create', 'stack_list', 'stack_delete', 'stack_show',
+           'stack_update')
+
+
+def __virtual__():
+    if REQUIREMENTS_MET:
+        return 'heatv1'
+    else:
+        return False, ("The heat execution module cannot be loaded: "
+                       "os_client_config is not available.")
diff --git a/_modules/heatv1/common.py b/_modules/heatv1/common.py
new file mode 100644
index 0000000..06eabff
--- /dev/null
+++ b/_modules/heatv1/common.py
@@ -0,0 +1,109 @@
+import logging
+import six
+import uuid
+
+import os_client_config
+from salt import exceptions
+
+
+log = logging.getLogger(__name__)
+
+SERVICE_KEY = 'orchestration'
+
+
+def get_raw_client(cloud_name):
+    config = os_client_config.OpenStackConfig()
+    cloud = config.get_one_cloud(cloud_name)
+    adapter = cloud.get_session_client(SERVICE_KEY)
+    adapter.version = '1'
+    try:
+        access_info = adapter.session.auth.get_access(adapter.session)
+        endpoints = access_info.service_catalog.get_endpoints()
+    except (AttributeError, ValueError) as exc:
+        six.raise_from(exc, exceptions.SaltInvocationError(
+            "Cannot load keystoneauth plugin. Please check your environment "
+            "configuration."))
+    if SERVICE_KEY not in endpoints:
+        raise exceptions.SaltInvocationError("Cannot find heat endpoint in "
+                                             "environment endpoint list.")
+    return adapter
+
+
+def send(method):
+    def wrap(func):
+        @six.wraps(func)
+        def wrapped_f(*args, **kwargs):
+            cloud_name = kwargs.get('cloud_name', None)
+            if not cloud_name:
+                raise exceptions.SaltInvocationError(
+                    "No cloud_name specified. Please provide cloud_name "
+                    "parameter")
+            adapter = get_raw_client(cloud_name)
+            # Remove salt internal kwargs
+            kwarg_keys = list(kwargs.keys())
+            for k in kwarg_keys:
+                if k.startswith('__'):
+                    kwargs.pop(k)
+            url, request_kwargs = func(*args, **kwargs)
+            try:
+                response = getattr(adapter, method.lower())(url,
+                                                            **request_kwargs)
+            except Exception as e:
+                log.exception("Error occured when executing request")
+                return {"result": False,
+                        "comment": str(e),
+                        "status_code": getattr(e, "http_status", 500)}
+            try:
+                resp_body = response.json() if response.content else {}
+            except:
+                resp_body = str(response.content)
+            return {"result": True,
+                    "body": resp_body,
+                    "status_code": response.status_code}
+        return wrapped_f
+    return wrap
+
+
+def _check_uuid(val):
+    try:
+        return str(uuid.UUID(val)) == val
+    except (TypeError, ValueError, AttributeError):
+        return False
+
+
+def get_by_name_or_uuid(resource_list, resp_key):
+    def wrap(func):
+        @six.wraps(func)
+        def wrapped_f(*args, **kwargs):
+            if 'name' in kwargs:
+                ref = kwargs.get('name', None)
+                start_arg = 0
+            else:
+                start_arg = 1
+                ref = args[0]
+                kwargs["name"] = ref
+            if _check_uuid(ref):
+                uuid = ref
+            else:
+                # Then we have name not uuid
+                cloud_name = kwargs['cloud_name']
+                resp = resource_list(
+                    name=ref, cloud_name=cloud_name)["body"][resp_key]
+                if len(resp) == 0:
+                    msg = ("Uniq {resource} resource "
+                           "with name={name} not found.").format(
+                        resource=resp_key, name=ref)
+                    return {"result": False,
+                            "body": msg,
+                            "status_code": 404}
+                elif len(resp) > 1:
+                    msg = ("Multiple resource: {resource} "
+                           "with name: {name} found ").format(
+                        resource=resp_key, name=ref)
+                    return {"result": False,
+                            "body": msg,
+                            "status_code": 400}
+                uuid = resp[0]['id']
+            return func(uuid, *args[start_arg:], **kwargs)
+        return wrapped_f
+    return wrap
\ No newline at end of file
diff --git a/_modules/heatv1/stack.py b/_modules/heatv1/stack.py
new file mode 100644
index 0000000..ace3db0
--- /dev/null
+++ b/_modules/heatv1/stack.py
@@ -0,0 +1,147 @@
+from yaml import safe_load
+import json
+import common
+try:
+    from urllib.parse import urlencode
+except ImportError:
+    from urllib import urlencode
+
+HEAT_ROOT = "/srv/heat/env"
+
+TEMPLATE_PATH = "template"
+ENV_PATH = "env"
+
+
+def _read_env_file(name):
+    path = "/".join([
+        HEAT_ROOT,
+        ENV_PATH,
+        name])
+
+    return _read_file(path)
+
+
+def _read_template_file(name):
+    path = "/".join([
+        HEAT_ROOT,
+        TEMPLATE_PATH,
+        name])
+
+    return _read_file(path)
+
+
+def _read_file(full_path):
+    with open(full_path, 'r') as f:
+        data = safe_load(f)
+        return json.dumps(data, default=str)
+
+
+def _read_additional_file(path):
+    full_path = "/".join([
+        HEAT_ROOT,
+        path])
+    with open(full_path) as f:
+        return str(f.read())
+
+
+@common.send("get")
+def stack_list(**kwargs):
+    url = "/stacks?{}".format(urlencode(kwargs))
+    return url, {}
+
+
+@common.get_by_name_or_uuid(stack_list, 'stacks')
+@common.send("get")
+def stack_show(stack_id, **kwargs):
+    stack_name = kwargs.get("name")
+    url = "/stacks/{stack_name}/{stack_id}".format(
+        stack_name=stack_name, stack_id=stack_id)
+    return url, {}
+
+
+@common.get_by_name_or_uuid(stack_list, 'stacks')
+@common.send("delete")
+def stack_delete(stack_id, **kwargs):
+    stack_name = kwargs.get("name")
+    url = "/stacks/{stack_name}/{stack_id}".format(stack_name=stack_name,
+                                                   stack_id=stack_id)
+    return url, {}
+
+
+@common.send("post")
+def stack_create(name, template=None, environment=None, environment_files=None,
+                 files=None, parameters=None, template_url=None,
+                 timeout_mins=5, disable_rollback=True, **kwargs):
+    url = "/stacks"
+    request = {'stack_name': name,
+               'timeout_mins': timeout_mins,
+               'disable_rollback': disable_rollback}
+    if environment:
+        request["environment"] = environment
+    file_items = {}
+    if environment_files:
+        env_names = []
+        env_files = {}
+        for f_name in environment_files:
+            data = _read_env_file(f_name)
+            env_files[f_name] = data
+            env_names.append(f_name)
+        file_items.update(env_files)
+        request["environment_files"] = env_names
+    if files:
+        for f_name, path in files.items():
+            file_items.update((f_name, _read_additional_file(path)))
+    if file_items:
+        request["files"] = file_items
+    if parameters:
+        request["parameters"] = parameters
+    if template:
+        template_file = _read_template_file(template)
+        request["template"] = template_file
+    if template_url:
+        request["template_url"] = template_url
+    # Validate the template and get back the params.
+
+    return url, {"json": request}
+
+
+@common.get_by_name_or_uuid(stack_list, 'stacks')
+@common.send("put")
+def stack_update(stack_id, template=None, environment=None,
+                 environment_files=None, files=None, parameters=None,
+                 template_url=None, timeout_mins=5, disable_rollback=True,
+                 clear_parameters=None, **kwargs):
+    stack_name = kwargs.get("name")
+    url = "/stacks/{stack_name}/{stack_id}".format(
+        stack_name=stack_name, stack_id=stack_id
+    )
+    request = {'stack_name': stack_name,
+               'timeout_mins': timeout_mins,
+               'disable_rollback': disable_rollback}
+    if environment:
+        request["environment"] = environment
+    file_items = {}
+    if environment_files:
+        env_names = []
+        env_files = {}
+        for f_name in environment_files:
+            data = _read_env_file(f_name)
+            env_files[f_name] = data
+            env_names.append(f_name)
+        file_items.update(env_files)
+        request["environment_files"] = env_names
+    if files:
+        for f_name, path in files.items():
+            file_items.update((f_name, _read_additional_file(path)))
+    if file_items:
+        request["files"] = file_items
+    if parameters:
+        request["parameters"] = parameters
+    if template:
+        template_file = _read_template_file(template)
+        request["template"] = template_file
+    if template_url:
+        request["template_url"] = template_url
+    if clear_parameters:
+        request["clear_parameters"] = clear_parameters
+    return url, {"json": request}
