terraform: generate conf with http backend

This commit is contained in:
Iain Learmonth 2022-08-30 10:05:12 +01:00
parent affa0f0149
commit 32239c379a
16 changed files with 43 additions and 4 deletions

View file

@ -50,6 +50,12 @@ class ListAutomation(TerraformAutomation):
MirrorList.provider == self.provider,
).all(),
global_namespace=app.config['GLOBAL_NAMESPACE'],
terraform_modules_path=os.path.join(*list(os.path.split(app.root_path))[:-1], 'terraform-modules'),
backend_config=f"""backend "http" {{
lock_address = "{app.config['TFSTATE_BACKEND']}/{self.short_name}"
unlock_address = "{app.config['TFSTATE_BACKEND']}/{self.short_name}"
address = "{app.config['TFSTATE_BACKEND']}/{self.short_name}"
}}""",
**{
k: app.config[k.upper()]
for k in self.template_parameters

View file

@ -17,6 +17,7 @@ class ListGithubAutomation(ListAutomation):
template = """
terraform {
{{ backend_config }}
required_providers {
github = {
source = "integrations/github"

View file

@ -16,6 +16,7 @@ class ListGitlabAutomation(ListAutomation):
template = """
terraform {
{{ backend_config }}
required_providers {
gitlab = {
source = "gitlabhq/gitlab"

View file

@ -13,6 +13,7 @@ class ListS3Automation(ListAutomation):
template = """
terraform {
{{ backend_config }}
required_providers {
aws = {
version = "~> 4.4.0"