fix region prefixes & backends

This commit is contained in:
Michael Jerger 2023-07-04 18:55:41 +02:00
parent b165b5d06c
commit 1c08952a86
9 changed files with 15 additions and 21 deletions

View file

@ -33,7 +33,7 @@ default_task = "dev"
name = "ddadevops" name = "ddadevops"
MODULE = "not-used" MODULE = "not-used"
PROJECT_ROOT_PATH = "." PROJECT_ROOT_PATH = "."
version = "4.0.0-dev75" version = "4.0.0-dev78"
summary = "tools to support builds combining gopass, terraform, dda-pallet, aws & hetzner-cloud" summary = "tools to support builds combining gopass, terraform, dda-pallet, aws & hetzner-cloud"
description = __doc__ description = __doc__
authors = [Author("meissa GmbH", "buero@meissa-gmbh.de")] authors = [Author("meissa GmbH", "buero@meissa-gmbh.de")]

View file

@ -57,6 +57,7 @@ class Aws(Validateable, CredentialMappingDefault):
result = { result = {
"aws_access_key": self.aws_access_key, "aws_access_key": self.aws_access_key,
"aws_secret_key": self.aws_secret_key, "aws_secret_key": self.aws_secret_key,
"aws_region": self.aws_region,
} }
if self.aws_as_backend: if self.aws_as_backend:
result.update( result.update(
@ -65,7 +66,6 @@ class Aws(Validateable, CredentialMappingDefault):
"bucket": self.aws_bucket, "bucket": self.aws_bucket,
"key": self.__bucket_key__(), "key": self.__bucket_key__(),
"kms_key_id": self.aws_bucket_kms_key_id, "kms_key_id": self.aws_bucket_kms_key_id,
"region": self.aws_region,
} }
) )
return result return result

View file

@ -2,4 +2,3 @@ variable "account_name" {}
variable "bucket" {} variable "bucket" {}
variable "key" {} variable "key" {}
variable "kms_key_id" {} variable "kms_key_id" {}
variable "region" {}

View file

@ -1,5 +1,5 @@
provider "aws" { provider "aws" {
region = var.region region = var.aws_region
access_key = var.aws_access_key access_key = var.aws_access_key
secret_key = var.aws_secret_key secret_key = var.aws_secret_key
} }

View file

@ -1,5 +1,3 @@
variable "aws_access_key" { variable "aws_access_key" {}
} variable "aws_secret_key" {}
variable "aws_region" {}
variable "aws_secret_key" {
}

View file

@ -1,29 +1,24 @@
terraform { terraform {
required_providers { required_providers {
exoscale = {
source = "exoscale/exoscale"
version = ">= 0.29.0"
}
hcloud = { hcloud = {
source = "hetznercloud/hcloud" source = "hetznercloud/hcloud"
version = ">= 1.23.0" version = ">= 1.41"
} }
aws = { aws = {
source = "hashicorp/aws" source = "hashicorp/aws"
version = "~> 3.0" version = "~> 5.6"
} }
hetznerdns = { hetznerdns = {
source = "timohirt/hetznerdns" source = "timohirt/hetznerdns"
version = ">= 1.1.0" version = ">= 2.2"
} }
digitalocean = { digitalocean = {
source = "digitalocean/digitalocean" source = "digitalocean/digitalocean"
version = "~> 2.0" version = "~> 2.28"
} }
} }
} }

View file

@ -66,6 +66,7 @@ def test_should_calculate_project_vars():
assert { assert {
"aws_access_key": "aws_access_key", "aws_access_key": "aws_access_key",
"aws_secret_key": "aws_secret_key", "aws_secret_key": "aws_secret_key",
"aws_region": "region",
} == sut.project_vars() } == sut.project_vars()
sut = Aws( sut = Aws(
@ -78,9 +79,9 @@ def test_should_calculate_project_vars():
assert { assert {
"aws_access_key": "aws_access_key", "aws_access_key": "aws_access_key",
"aws_secret_key": "aws_secret_key", "aws_secret_key": "aws_secret_key",
"aws_region": "region",
"account_name": "test", "account_name": "test",
"bucket": "bucket", "bucket": "bucket",
"key": "test/module", "key": "test/module",
"kms_key_id": "aws_bucket_kms_key_id", "kms_key_id": "aws_bucket_kms_key_id",
"region": "region",
} == sut.project_vars() } == sut.project_vars()

View file

@ -76,9 +76,9 @@ def test_should_calculate_project_vars():
"do_api_key": "api_key", "do_api_key": "api_key",
"do_spaces_access_id": "spaces_id", "do_spaces_access_id": "spaces_id",
"do_spaces_secret_key": "spaces_secret", "do_spaces_secret_key": "spaces_secret",
"region": "region",
"account_name": "test", "account_name": "test",
"endpoint": "endpoint", "endpoint": "endpoint",
"bucket": "bucket", "bucket": "bucket",
"key": "test/module", "key": "test/module",
"region": "region",
} == sut.project_vars() } == sut.project_vars()

View file

@ -89,6 +89,7 @@ def test_should_calculate_project_vars():
"hetzner_api_key": "hetzner_api_key", "hetzner_api_key": "hetzner_api_key",
"aws_access_key": "aws_access_key", "aws_access_key": "aws_access_key",
"aws_secret_key": "aws_secret_key", "aws_secret_key": "aws_secret_key",
"aws_region": "region",
} == sut.project_vars() } == sut.project_vars()