diff --git a/README.md b/README.md index 0b2cd37..0816f51 100644 --- a/README.md +++ b/README.md @@ -22,18 +22,18 @@ Ensure that yout python3 version is at least Python 3.7! ``` sudo apt install python3-pip -pip3 install pip3 --upgrade --user -pip3 install pybuilder ddadevops deprecation --user +pip3 install pip3 --upgrade +pip3 install pybuilder ddadevops deprecation export PATH=$PATH:~/.local/bin # in case of using terraform -pip3 install dda-python-terraform --user +pip3 install dda-python-terraform packaging # in case of using AwsMixin -pip3 install boto3 --user +pip3 install boto3 # in case of using AwsMfaMixin -pip3 install boto3 mfa --user +pip3 install boto3 mfa ``` # Example Build diff --git a/build.py b/build.py index 5dc707c..a90f398 100644 --- a/build.py +++ b/build.py @@ -28,7 +28,7 @@ use_plugin("python.distutils") default_task = "publish" name = "ddadevops" -version = "2.0.2" +version = "2.0.3" summary = "tools to support builds combining gopass, terraform, dda-pallet, aws & hetzner-cloud" description = __doc__ authors = [Author("meissa GmbH", "buero@meissa-gmbh.de")] diff --git a/dev_requirements.txt b/dev_requirements.txt index 3c2e184..25d5dae 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -10,4 +10,5 @@ pytest==7.1 pytest-cov==3.0 pytest-datafiles==2.0 dda-python-terraform==2.0.1 +packaging==3.0 boto3==1.24 \ No newline at end of file diff --git a/doc/releasing.md b/doc/releasing.md index e8cbc0b..4b00776 100644 --- a/doc/releasing.md +++ b/doc/releasing.md @@ -5,4 +5,4 @@ git push --follow-tags increase version no in build.py git commit -am "version bump" git push -pip3 install --upgrade --user ddadevops \ No newline at end of file +pip3 install --upgrade ddadevops \ No newline at end of file diff --git a/src/main/python/ddadevops/aws_backend_properties_mixin.py b/src/main/python/ddadevops/aws_backend_properties_mixin.py index 0a1b961..b3c2bfe 100644 --- a/src/main/python/ddadevops/aws_backend_properties_mixin.py +++ b/src/main/python/ddadevops/aws_backend_properties_mixin.py @@ -38,7 +38,7 @@ class AwsBackendPropertiesMixin(DevopsTerraformBuild): pass def init_client(self): - tf = Terraform(working_dir=self.build_path(), terraform_version=self.terraform_version) + tf = Terraform(working_dir=self.build_path(), terraform_semantic_version=self.terraform_semantic_version) tf.init(backend_config=self.backend_config) self.print_terraform_command(tf) if self.use_workspace: diff --git a/src/main/python/ddadevops/devops_terraform_build.py b/src/main/python/ddadevops/devops_terraform_build.py index 61036c2..95bd834 100644 --- a/src/main/python/ddadevops/devops_terraform_build.py +++ b/src/main/python/ddadevops/devops_terraform_build.py @@ -5,6 +5,7 @@ from pkg_resources import * from dda_python_terraform import * from .python_util import filter_none from .devops_build import DevopsBuild, create_devops_build_config +from packaging import version import sys @@ -20,9 +21,9 @@ def create_devops_terraform_build_config(stage, terraform_build_commons_dir_name='terraform', debug_print_terraform_command=False, additional_tfvar_files=[], - terraform_version=0.15): + terraform_semantic_version="1.0.8"): if not output_json_name: - output_json_name = 'out_' + module + '.json' + output_json_name = 'out_' + module + '.json' ret = create_devops_build_config( stage, project_root_path, module, build_dir_name) ret.update({'additional_vars': additional_vars, @@ -33,7 +34,7 @@ def create_devops_terraform_build_config(stage, 'terraform_build_commons_dir_name': terraform_build_commons_dir_name, 'debug_print_terraform_command': debug_print_terraform_command, 'additional_tfvar_files': additional_tfvar_files, - 'terraform_version': terraform_version}) + 'terraform_semantic_version': terraform_semantic_version}) return ret class DevopsTerraformBuild(DevopsBuild): @@ -49,7 +50,7 @@ class DevopsTerraformBuild(DevopsBuild): self.terraform_build_commons_dir_name = config['terraform_build_commons_dir_name'] self.debug_print_terraform_command = config['debug_print_terraform_command'] self.additional_tfvar_files = config['additional_tfvar_files'] - self.terraform_version = config['terraform_version'] + self.terraform_semantic_version = config['terraform_semantic_version'] def terraform_build_commons_path(self): mylist = [self.build_commons_path, @@ -100,7 +101,7 @@ class DevopsTerraformBuild(DevopsBuild): self.rescue_local_state() def init_client(self): - tf = Terraform(working_dir=self.build_path(), terraform_version=self.terraform_version) + tf = Terraform(working_dir=self.build_path(), terraform_semantic_version=self.terraform_semantic_version) tf.init() self.print_terraform_command(tf) if self.use_workspace: @@ -151,7 +152,7 @@ class DevopsTerraformBuild(DevopsBuild): auto_approve_flag = IsFlagged else: auto_approve_flag = None - if self.terraform_version >= 1.0: + if version.parse(self.terraform_semantic_version) >= version.parse("1.0.0"): return_code, stdout, stderr = tf.apply(capture_output=False, raise_on_error=True, auto_approve=auto_approve_flag, var=self.project_vars(), @@ -184,7 +185,7 @@ class DevopsTerraformBuild(DevopsBuild): auto_approve_flag = IsFlagged else: auto_approve_flag = None - if self.terraform_version >= 1.0: + if version.parse(self.terraform_semantic_version) >= version.parse("1.0.0"): return_code, stdout, stderr = tf.destroy(capture_output=False, raise_on_error=True, auto_approve=auto_approve_flag, var=self.project_vars(),