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 Proxy.destroyed == None
).all(), ).all(),
global_namespace=app.config['GLOBAL_NAMESPACE'], global_namespace=app.config['GLOBAL_NAMESPACE'],
bypass_token=app.config['BYPASS_TOKEN'],
**{ **{
k: app.config[k.upper()] k: app.config[k.upper()]
for k in self.template_parameters for k in self.template_parameters

View file

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

View file

@ -65,7 +65,7 @@ class ProxyCloudfrontAutomation(ProxyAutomation):
{% for proxy in proxies %} {% for proxy in proxies %}
module "cloudfront_{{ proxy.id }}" { module "cloudfront_{{ proxy.id }}" {
source = "sr2c/bc-proxy/aws" source = "sr2c/bc-proxy/aws"
version = "0.0.5" version = "0.0.7"
origin_domain = "{{ proxy.origin.domain_name }}" origin_domain = "{{ proxy.origin.domain_name }}"
logging_bucket = module.log_bucket_{{ proxy.origin.group.id }}.bucket_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 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 context = module.label_{{ proxy.origin.group.id }}.context
name = "proxy" name = "proxy"
attributes = ["{{ proxy.origin.domain_name }}"] attributes = ["{{ proxy.origin.domain_name }}"]
bypass_token = "{{ bypass_token }}"
} }
{% endfor %} {% endfor %}
""" """