add do mixin

This commit is contained in:
jerger 2022-12-09 14:53:54 +01:00
parent 80947e6684
commit 8cb3da6d92
5 changed files with 38 additions and 1 deletions

View file

@ -28,7 +28,7 @@ use_plugin("python.distutils")
default_task = "publish"
name = "ddadevops"
version = "1.1.0-dev"
version = "2.0.0-dev"
summary = "tools to support builds combining gopass, terraform, dda-pallet, aws & hetzner-cloud"
description = __doc__
authors = [Author("meissa GmbH", "buero@meissa-gmbh.de")]

View file

@ -0,0 +1,27 @@
from .devops_terraform_build import DevopsTerraformBuild
def add_digitalocean_mixin_config(config, do_api_key):
config.update({'DigitaloceanMixin':
{'do_api_key': do_api_key}})
return config
class DigitaloceanMixin(DevopsTerraformBuild):
def __init__(self, project, config):
super().__init__(project, config)
do_mixin_config = config['DigitaloceanMixin']
self.do_api_key = do_mixin_config['do_api_key']
def project_vars(self):
ret = super().project_vars()
if self.do_api_key:
ret['do_api_key'] = self.do_api_key
return ret
def copy_build_resources_from_package(self):
super().copy_build_resources_from_package()
self.copy_build_resource_file_from_package('provider_registry.tf')
self.copy_build_resource_file_from_package('do_provider.tf')
self.copy_build_resource_file_from_package('do_mixin_vars.tf')

View file

@ -0,0 +1,2 @@
variable "do_api_key" {
}

View file

@ -0,0 +1,3 @@
provider "digitalocean" {
token = var.do_api_key
}

View file

@ -20,5 +20,10 @@ terraform {
source = "timohirt/hetznerdns"
version = ">= 1.1.0"
}
digitalocean = {
source = "digitalocean/digitalocean"
version = "~> 2.0"
}
}
}