Rename to TERRAFORM_BACKEND_GIT

This commit is contained in:
patdyn 2024-06-26 15:25:34 +02:00
parent 6e5275b56b
commit 4eadad3940
4 changed files with 23 additions and 13 deletions

View file

@ -17,6 +17,7 @@ class ProviderType(Enum):
DIGITALOCEAN = 0
HETZNER = 1
AWS = 2
TERRAFORM_BACKEND_GIT = 3
class MixinType(Enum):

View file

@ -6,6 +6,7 @@ from .devops_factory import DevopsFactory
from .terraform import TerraformDomain
from .provider_digitalocean import Digitalocean
from .provider_hetzner import Hetzner
from .provider_tf_backend_git import TerraformBackendGit
from .c4k import C4k
from .image import Image
from .release import ReleaseType, Release
@ -60,6 +61,8 @@ class InitService:
default_mappings += Digitalocean.get_mapping_default()
if ProviderType.HETZNER in provider_types:
default_mappings += Hetzner.get_mapping_default()
if ProviderType.TERRAFORM_BACKEND_GIT in provider_types:
default_mappings += TerraformBackendGit.get_mapping_default()
if MixinType.RELEASE in mixin_types:
primary_build_file_id = inp.get(

View file

@ -1,7 +1,7 @@
from typing import List, Dict, Set, Any
from .common import Validateable, CredentialMappingDefault
class TerraformGitBackend(Validateable, CredentialMappingDefault):
class TerraformBackendGit(Validateable, CredentialMappingDefault):
def __init__(
self,
inp: dict,
@ -40,5 +40,8 @@ class TerraformGitBackend(Validateable, CredentialMappingDefault):
"git_backend_token": self.git_backend_token,
"git_backend_username": self.git_backend_username,
}
#ToDo:
def get_mapping_default():
pass

View file

@ -8,6 +8,7 @@ from .common import (
from .provider_digitalocean import Digitalocean
from .provider_hetzner import Hetzner
from .provider_aws import Aws
from .provider_tf_backend_git import TerraformBackendGit
class TerraformDomain(Validateable):
@ -42,6 +43,8 @@ class TerraformDomain(Validateable):
self.providers[ProviderType.HETZNER] = Hetzner(inp)
if ProviderType.AWS in provider_types:
self.providers[ProviderType.AWS] = Aws(inp)
if ProviderType.TERRAFORM_BACKEND_GIT in provider_types:
self.providers[ProviderType.TERRAFORM_BACKEND_GIT] = TerraformBackendGit(inp)
def validate(self) -> List[str]:
result = []
@ -87,7 +90,7 @@ class TerraformDomain(Validateable):
return result
def uses_backend_git(self) -> bool:
return ProviderType.TERRAFORM_GIT_BACKEND in self.providers.keys()
return ProviderType.TERRAFORM_BACKEND_GIT in self.providers.keys()
def backend_config(self) -> Dict[str, Any]:
result = {}