add do mixin
This commit is contained in:
parent
80947e6684
commit
8cb3da6d92
5 changed files with 38 additions and 1 deletions
2
build.py
2
build.py
|
@ -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")]
|
||||
|
|
27
src/main/python/ddadevops/digiatlocean_mixin.py
Normal file
27
src/main/python/ddadevops/digiatlocean_mixin.py
Normal 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')
|
2
src/main/resources/terraform/do_mixin_vars.tf
Normal file
2
src/main/resources/terraform/do_mixin_vars.tf
Normal file
|
@ -0,0 +1,2 @@
|
|||
variable "do_api_key" {
|
||||
}
|
3
src/main/resources/terraform/do_provider.tf
Normal file
3
src/main/resources/terraform/do_provider.tf
Normal file
|
@ -0,0 +1,3 @@
|
|||
provider "digitalocean" {
|
||||
token = var.do_api_key
|
||||
}
|
|
@ -20,5 +20,10 @@ terraform {
|
|||
source = "timohirt/hetznerdns"
|
||||
version = ">= 1.1.0"
|
||||
}
|
||||
|
||||
digitalocean = {
|
||||
source = "digitalocean/digitalocean"
|
||||
version = "~> 2.0"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue