add exoscale
This commit is contained in:
parent
bd5bb74e96
commit
58fbe9b3d4
6 changed files with 47 additions and 2 deletions
2
build.py
2
build.py
|
@ -28,7 +28,7 @@ use_plugin("python.distutils")
|
|||
default_task = "publish"
|
||||
|
||||
name = "ddadevops"
|
||||
version = "0.12.8-dev"
|
||||
version = "0.13.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")]
|
||||
|
|
|
@ -9,6 +9,7 @@ from .devops_build import DevopsBuild, create_devops_build_config, get_devops_bu
|
|||
from .devops_terraform_build import DevopsTerraformBuild, create_devops_terraform_build_config
|
||||
from .devops_docker_build import DevopsDockerBuild, create_devops_docker_build_config
|
||||
from .hetzner_mixin import HetznerMixin, add_hetzner_mixin_config
|
||||
from .exoscale_mixin import ExoscaleMixin, add_exoscale_mixin_config
|
||||
from .aws_backend_properties_mixin import AwsBackendPropertiesMixin, add_aws_backend_properties_mixin_config
|
||||
from .aws_mfa_mixin import AwsMfaMixin, add_aws_mfa_mixin_config
|
||||
from .aws_rds_pg_mixin import AwsRdsPgMixin, add_aws_rds_pg_mixin_config
|
||||
|
|
30
src/main/python/ddadevops/exoscale_mixin.py
Normal file
30
src/main/python/ddadevops/exoscale_mixin.py
Normal file
|
@ -0,0 +1,30 @@
|
|||
from .devops_terraform_build import DevopsTerraformBuild
|
||||
|
||||
|
||||
def add_exoscale_mixin_config(config, exoscale_api_key, exoscale_secret_key):
|
||||
config.update({'ExoscaleMixin':
|
||||
{'exoscale_api_key': exoscale_api_key,
|
||||
'exoscale_secret_key': exoscale_secret_key}})
|
||||
return config
|
||||
|
||||
|
||||
class ExoscaleMixin(DevopsTerraformBuild):
|
||||
|
||||
def __init__(self, project, config):
|
||||
super().__init__(project, config)
|
||||
exoscale_mixin_config = config['ExoscaleMixin']
|
||||
self.exoscale_api_key = exoscale_mixin_config['exoscale_api_key']
|
||||
self.exoscale_secret_key = exoscale_mixin_config['exoscale_secret_key']
|
||||
|
||||
def project_vars(self):
|
||||
ret = super().project_vars()
|
||||
if self.exoscale_api_key:
|
||||
ret['exoscale_api_key'] = self.exoscale_api_key
|
||||
if self.exoscale_secret_key:
|
||||
ret['exoscale_secret_key'] = self.exoscale_secret_key
|
||||
return ret
|
||||
|
||||
def copy_build_resources_from_package(self):
|
||||
super().copy_build_resources_from_package()
|
||||
self.copy_build_resource_file_from_package('exoscale_provider.tf')
|
||||
self.copy_build_resource_file_from_package('exoscale_mixin_vars.tf')
|
5
src/main/resources/terraform/exoscale_mixin_vars.tf
Normal file
5
src/main/resources/terraform/exoscale_mixin_vars.tf
Normal file
|
@ -0,0 +1,5 @@
|
|||
variable "exoscale_api_key" {
|
||||
}
|
||||
|
||||
variable "exoscale_secret_key" {
|
||||
}
|
4
src/main/resources/terraform/exoscale_provider.tf
Normal file
4
src/main/resources/terraform/exoscale_provider.tf
Normal file
|
@ -0,0 +1,4 @@
|
|||
provider "exoscale" {
|
||||
key = "${var.exoscale_api_key}"
|
||||
secret = "${var.exoscale_secret_key}"
|
||||
}
|
|
@ -1,8 +1,13 @@
|
|||
terraform {
|
||||
required_providers {
|
||||
|
||||
exoscale = {
|
||||
source = "exoscale/exoscale"
|
||||
version = ">= 0.29.0"
|
||||
}
|
||||
|
||||
hcloud = {
|
||||
source = "hetznercloud/hcloud" # this whole block is important
|
||||
source = "hetznercloud/hcloud"
|
||||
version = ">= 1.23.0"
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue