def _get_template_location()

in iact3/config.py [0:0]


    def _get_template_location(self, template: Union[str, Path] = None) -> any:
        suffix = ('json', 'yaml', 'yml')
        template_path = Path(template).resolve() if template else DEFAULT_TEMPLATE_PATH
        if template_path.is_file():
            return template_path
        template_file = None
        for su in suffix:
            template_file = next(template_path.glob(f'*.template.{su}'), None)
            if template_file is not None:
                break
        if template_file is None:
            tf_content = {}
            for path, dirs, files in os.walk(template_path):
                for file in files:
                    if not file.endswith('.tf'):
                        continue
                    file_path = os.path.join(path, file)
                    with open(file_path, 'r', encoding='utf-8') as f:
                        content = f.read()
                    tf_content[file_path] = content

            if not tf_content:
                return

            common_path = os.path.commonpath(list(tf_content))
            work_space = {
                p.replace(common_path + '/', ''): value for p, value in tf_content.items()
            }
            return {
                'ROSTemplateFormatVersion': '2015-09-01',
                'Transform': self._get_tf_version(),
                'Workspace': work_space
            }
        return template_file