proxy_fastly: set urls
This commit is contained in:
parent
2f3feca27a
commit
371c287f3e
1 changed files with 12 additions and 7 deletions
|
@ -1,5 +1,7 @@
|
||||||
from typing import Any
|
from typing import Any, Optional
|
||||||
|
|
||||||
|
from app.extensions import db
|
||||||
|
from app.models.mirrors import Proxy
|
||||||
from app.terraform.proxy import ProxyAutomation
|
from app.terraform.proxy import ProxyAutomation
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,7 +44,7 @@ class ProxyFastlyAutomation(ProxyAutomation):
|
||||||
module "label_{{ group.id }}" {
|
module "label_{{ group.id }}" {
|
||||||
source = "cloudposse/label/null"
|
source = "cloudposse/label/null"
|
||||||
version = "0.25.0"
|
version = "0.25.0"
|
||||||
namespace = "bc"
|
namespace = "{{ global_namespace }}"
|
||||||
tenant = "{{ group.group_name }}"
|
tenant = "{{ group.group_name }}"
|
||||||
label_order = ["namespace", "tenant", "name", "attributes"]
|
label_order = ["namespace", "tenant", "name", "attributes"]
|
||||||
}
|
}
|
||||||
|
@ -59,7 +61,6 @@ class ProxyFastlyAutomation(ProxyAutomation):
|
||||||
expiration_days = 90
|
expiration_days = 90
|
||||||
}
|
}
|
||||||
|
|
||||||
{% if group.id == 3 %}
|
|
||||||
{% for subgroup in subgroups[group.id] %}
|
{% for subgroup in subgroups[group.id] %}
|
||||||
resource "fastly_service_vcl" "service_{{ group.id }}_{{ subgroup }}" {
|
resource "fastly_service_vcl" "service_{{ group.id }}_{{ subgroup }}" {
|
||||||
name = "${module.label_{{ group.id }}.id}-{{ subgroup }}"
|
name = "${module.label_{{ group.id }}.id}-{{ subgroup }}"
|
||||||
|
@ -108,10 +109,14 @@ class ProxyFastlyAutomation(ProxyAutomation):
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{% endfor %}{# subgroup #}
|
{% endfor %}{# subgroup #}
|
||||||
{% endif %}{# group.id == 3 #}
|
|
||||||
|
|
||||||
{% endfor %}{# group #}
|
{% endfor %}{# group #}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def import_state(self, state: Any) -> None:
|
def import_state(self, state: Optional[Any]) -> None:
|
||||||
pass
|
proxies = Proxy.query.filter(
|
||||||
|
Proxy.provider == self.provider,
|
||||||
|
Proxy.destroyed.is_(None)
|
||||||
|
).all()
|
||||||
|
for proxy in proxies:
|
||||||
|
proxy.url = f"https://{{ proxy.slug }}.global.ssl.fastly.net"
|
||||||
|
db.session.commit()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue