automation: bring eotk into new framework

see: #1
This commit is contained in:
Iain Learmonth 2022-05-09 08:55:11 +01:00
parent aa0ff5802f
commit 257a2eacea
2 changed files with 11 additions and 13 deletions

View file

@ -1,10 +1,11 @@
from app import app
from app.models.base import Group
from app.terraform import BaseAutomation
from app.terraform.terraform import TerraformAutomation
class EotkAutomation(BaseAutomation):
class EotkAutomation(TerraformAutomation):
short_name = "eotk"
description = "Deploy EOTK instances to AWS"
template_parameters = [
"aws_access_key",
@ -50,21 +51,16 @@ class EotkAutomation(BaseAutomation):
{% endfor %}
"""
def generate_terraform(self):
self.write_terraform_config(
def tf_generate(self):
self.tf_write(
self.template,
groups=Group.query.filter(Group.eotk == True).all(),
groups=Group.query.filter(
Group.eotk == True,
Group.destroyed == None
).all(),
global_namespace=app.config['GLOBAL_NAMESPACE'],
**{
k: app.config[k.upper()]
for k in self.template_parameters
}
)
if __name__ == "__main__":
with app.app_context():
auto = EotkAutomation()
auto.generate_terraform()
auto.terraform_init()
auto.terraform_apply()