fix aws_apply

This commit is contained in:
jem 2020-03-05 12:08:50 +01:00
parent f49234d1f4
commit 01464ac2c8
3 changed files with 25 additions and 1 deletions

View file

@ -27,11 +27,12 @@ use_plugin("python.distutils")
default_task = "publish"
name = "ddadevops"
version = "0.4.0.dev15"
version = "0.4.0.dev18"
summary = "tools to support builds combining gopass, terraform, dda-pallet, aws & hetzner-cloud"
description = __doc__
authors = [Author("meissa GmbH", "buero@meissa-gmbh.de")]
url = "https://github.com/DomainDrivenArchitecture/dda-devops-build"
requires_python = ">=2.7,!=3.0,!=3.1,!=3.2,!=3.3,!=3.4,<3.9"
license = "Apache Software License"
@init
@ -52,7 +53,17 @@ def initialize(project):
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Operating System :: POSIX :: Linux',
'Operating System :: OS Independent',
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Topic :: Software Development :: Build Tools',
'Topic :: Software Development :: Quality Assurance',
'Topic :: Software Development :: Testing'
])

View file

@ -15,6 +15,7 @@ class AwsMixin(DevopsTerraformBuild):
def __init__(self, project, config):
super().__init__(project, config)
project.build_depends_on('boto3')
aws_mixin_config = config['AwsMixin']
self.account_name = aws_mixin_config['account_name']
@ -41,6 +42,17 @@ class AwsMixin(DevopsTerraformBuild):
tf.plan(capture_output=False, var=self.project_vars(),
var_file=self.backend_config())
def apply(self, p_auto_approve=False):
tf = self.init_client()
tf.apply(capture_output=False, auto_approve=p_auto_approve,
var=self.project_vars(), var_file=self.backend_config())
self.write_output(tf)
def destroy(self, p_auto_approve=False):
tf = self.init_client()
tf.destroy(capture_output=False, auto_approve=p_auto_approve,
var=self.project_vars(), var_file=self.backend_config())
def get_username_from_account(self, p_account_name):
login_id = execute('cat ~/.aws/accounts | grep -A 2 "\[' + p_account_name +
'\]" | grep username | awk -F= \'{print $2}\'', shell=True)

View file

@ -26,6 +26,7 @@ class DevopsTerraformBuild(DevopsBuild):
def __init__(self, project, config):
super().__init__(project, config)
project.build_depends_on('python-terraform')
self.additional_vars = config['additional_vars']
self.terraform_build_commons_dir_name = config['terraform_build_commons_dir_name']
self.output_json_name = config['output_json_name']