proxies: add support for bypass token

This commit is contained in:
Iain Learmonth 2022-04-19 14:32:04 +01:00
parent 6d989db3ef
commit 018494bd58
3 changed files with 7 additions and 8 deletions

View file

@ -44,6 +44,7 @@ class ProxyAutomation(BaseAutomation):
Proxy.destroyed == None
).all(),
global_namespace=app.config['GLOBAL_NAMESPACE'],
bypass_token=app.config['BYPASS_TOKEN'],
**{
k: app.config[k.upper()]
for k in self.template_parameters

View file

@ -128,21 +128,18 @@ class ProxyAzureCdnAutomation(ProxyAutomation):
location = "{{ azure_location }}"
resource_group_name = data.azurerm_resource_group.this.name
origin_host_header = "{{ proxy.origin.domain_name }}"
origin {
name = "upstream"
host_name = "{{ proxy.origin.domain_name }}"
}
global_delivery_rule {
modify_request_header_action {
action = "Overwrite"
name = "User-Agent"
value = "Amazon CloudFront"
}
modify_request_header_action {
action = "Append"
name = "X-Amz-Cf-Id"
value = "dummystring"
name = "Bypass-Rate-Limit-Token"
value = "{{ bypass_token }}"
}
}
}

View file

@ -65,7 +65,7 @@ class ProxyCloudfrontAutomation(ProxyAutomation):
{% for proxy in proxies %}
module "cloudfront_{{ proxy.id }}" {
source = "sr2c/bc-proxy/aws"
version = "0.0.5"
version = "0.0.7"
origin_domain = "{{ proxy.origin.domain_name }}"
logging_bucket = module.log_bucket_{{ proxy.origin.group.id }}.bucket_domain_name
sns_topic_arn = aws_sns_topic.alarms_{{ proxy.origin.group.id }}.arn
@ -73,6 +73,7 @@ class ProxyCloudfrontAutomation(ProxyAutomation):
context = module.label_{{ proxy.origin.group.id }}.context
name = "proxy"
attributes = ["{{ proxy.origin.domain_name }}"]
bypass_token = "{{ bypass_token }}"
}
{% endfor %}
"""