This commit is contained in:
patdyn 2024-06-27 10:18:44 +02:00
parent 9cdd647514
commit a6b6a6b8bc

View file

@ -13,50 +13,50 @@ class DevopsTerraformBuild(DevopsBuild):
inp["mixin_types"] = config.get("mixin_types", [])
super().__init__(project, inp)
project.build_depends_on("dda-python-terraform")
self.teraform_service = TerraformService.prod()
self.terraform_service = TerraformService.prod()
# ToDo: we might want to make this private in the future, keeping this for compatibility
def initialize_build_dir(self):
super().initialize_build_dir()
devops = self.devops_repo.get_devops(self.project)
self.teraform_service.initialize_build_dir(devops)
self.terraform_service.initialize_build_dir(devops)
def pre_build(self):
self.initialize_build_dir()
devops = self.devops_repo.get_devops(self.project)
if self.teraform_service.uses_backend_git(devops):
self.teraform_service.start_tf_backend_git_daemon()
if self.terraform_service.uses_backend_git(devops):
self.terraform_service.start_tf_backend_git_daemon()
def post_build(self):
devops = self.devops_repo.get_devops(self.project)
self.teraform_service.post_build(devops)
self.terraform_service.post_build(devops)
def read_output_json(self) -> map:
devops = self.devops_repo.get_devops(self.project)
return self.teraform_service.read_output(devops)
return self.terraform_service.read_output(devops)
def plan(self):
devops = self.devops_repo.get_devops(self.project)
self.teraform_service.plan(devops)
self.terraform_service.plan(devops)
self.post_build()
def plan_fail_on_diff(self):
devops = self.devops_repo.get_devops(self.project)
self.teraform_service.plan(devops, fail_on_diff=True)
self.terraform_service.plan(devops, fail_on_diff=True)
self.post_build()
def apply(self, auto_approve=False):
devops = self.devops_repo.get_devops(self.project)
self.teraform_service.apply(devops, auto_approve=auto_approve)
self.terraform_service.apply(devops, auto_approve=auto_approve)
self.post_build()
def refresh(self):
devops = self.devops_repo.get_devops(self.project)
self.teraform_service.refresh(devops)
self.terraform_service.refresh(devops)
self.post_build()
def destroy(self, auto_approve=False):
devops = self.devops_repo.get_devops(self.project)
self.teraform_service.destroy(devops, auto_approve=auto_approve)
self.terraform_service.destroy(devops, auto_approve=auto_approve)
self.post_build()
def tf_import(
@ -65,5 +65,5 @@ class DevopsTerraformBuild(DevopsBuild):
tf_import_resource,
):
devops = self.devops_repo.get_devops(self.project)
self.teraform_service.tf_import(devops, tf_import_name, tf_import_resource)
self.terraform_service.tf_import(devops, tf_import_name, tf_import_resource)
self.post_build()