Update provider with correct vars

This commit is contained in:
patdyn 2024-06-26 16:52:40 +02:00
parent ce9d3fdee6
commit f9f2389c95

View file

@ -25,22 +25,38 @@ class TerraformBackendGit(Validateable, CredentialMappingDefault):
result += self.__validate_is_not_empty__("git_backend_token")
return result
# See: https://developer.hashicorp.com/terraform/language/settings/backends/configuration#command-line-key-value-pairs
# and https://github.com/plumber-cd/terraform-backend-git?tab=readme-ov-file#standalone-terraform-http-backend-mode
def backend_config(self) -> Dict[str, Any]:
return {
"git_backend_repo": self.git_backend_repo,
"git_backend_ref": self.git_backend_ref,
"git_backend_state": self.git_backend_state,
"git_backend_username": self.git_backend_username,
"git_backend_token": self.git_backend_token,
"address": self.__make_http_backend_address__(self.git_backend_repo, self.git_backend_ref, self.git_backend_state),
"lock_address": self.__make_http_backend_address__(self.git_backend_repo, self.git_backend_ref, self.git_backend_state),
"unlock_address": self.__make_http_backend_address__(self.git_backend_repo, self.git_backend_ref, self.git_backend_state),
}
def project_vars(self):
def resources_from_package(self) -> List[str]:
return {"tf_backend_git_backend.tf", "tf_backend_git_backend_vars.tf"}
# ToDo: This can not be used for backend config, as the backend block can not reference vars.
def project_vars(self) -> Dict[str, Any]:
return {
"git_backend_token": self.git_backend_token,
"git_backend_username": self.git_backend_username,
"http_backend_address": self.__make_http_backend_address__(self.git_backend_ref, self.git_backend_repo, self.git_backend_state)
}
#ToDo:
def is_local_state(self):
return False
# ToDo:
def __bucket_key__(self):
pass
# ToDo:
def __make_http_backend_address__(self):
pass
# ToDo:
@classmethod
def get_mapping_default():
pass