feat(proxy): use route53 for smart proxy dns
This commit is contained in:
parent
d6e44cdc0a
commit
aec4c48842
2 changed files with 3 additions and 37 deletions
|
@ -116,7 +116,7 @@ class ProxyAutomation(TerraformAutomation):
|
||||||
{% for origin in origins %}
|
{% for origin in origins %}
|
||||||
server {
|
server {
|
||||||
listen 443 ssl;
|
listen 443 ssl;
|
||||||
server_name origin-{{ origin.id }}.{{ provider }}.smart.{{ smart_zone[:-1] }};
|
server_name origin-{{ origin.id }}.{{ smart_zone[:-1] }};
|
||||||
location / {
|
location / {
|
||||||
proxy_set_header Accept-Encoding "";
|
proxy_set_header Accept-Encoding "";
|
||||||
proxy_ssl_server_name on;
|
proxy_ssl_server_name on;
|
||||||
|
|
|
@ -33,9 +33,6 @@ class ProxyCloudfrontAutomation(ProxyAutomation):
|
||||||
aws = {
|
aws = {
|
||||||
version = "~> 4.41.0"
|
version = "~> 4.41.0"
|
||||||
}
|
}
|
||||||
dns = {
|
|
||||||
version = "~> 3.2.3"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,21 +46,7 @@ class ProxyCloudfrontAutomation(ProxyAutomation):
|
||||||
region = "us-east-2"
|
region = "us-east-2"
|
||||||
}
|
}
|
||||||
|
|
||||||
provider "dns" {
|
|
||||||
update {
|
|
||||||
server = local.rfc2136_nameserver
|
|
||||||
key_name = local.rfc2136_tsig_key
|
|
||||||
key_secret = local.rfc2136_tsig_secret
|
|
||||||
key_algorithm = "hmac-sha512"
|
|
||||||
timeout = "60s"
|
|
||||||
retries = 5
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
locals {
|
locals {
|
||||||
rfc2136_nameserver = "{{ rfc2136_nameserver }}"
|
|
||||||
rfc2136_tsig_key = "{{ rfc2136_tsig_key }}"
|
|
||||||
rfc2136_tsig_secret = "{{ rfc2136_tsig_secret }}"
|
|
||||||
smart_zone = "{{ smart_zone }}"
|
smart_zone = "{{ smart_zone }}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,28 +81,11 @@ class ProxyCloudfrontAutomation(ProxyAutomation):
|
||||||
source = "{{ terraform_modules_path }}/terraform-aws-bc-smart-proxy-instance"
|
source = "{{ terraform_modules_path }}/terraform-aws-bc-smart-proxy-instance"
|
||||||
context = module.label_{{ group.id }}.context
|
context = module.label_{{ group.id }}.context
|
||||||
name = "smart-proxy"
|
name = "smart-proxy"
|
||||||
|
config_filename = "smart_proxy.{{ group.id }}.conf"
|
||||||
disable_api_termination = false
|
disable_api_termination = false
|
||||||
domain_name = "cloudfront.smart.${local.smart_zone}"
|
dns_zone = "{{ smart_aws_zone }}"
|
||||||
rfc2136_nameserver = local.rfc2136_nameserver
|
|
||||||
rfc2136_tsig_key = local.rfc2136_tsig_key
|
|
||||||
rfc2136_tsig_secret = local.rfc2136_tsig_secret
|
|
||||||
max_transfer_per_hour = "10000000000"
|
max_transfer_per_hour = "10000000000"
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "aws_s3_object" "smart_config_{{ group.id }}" {
|
|
||||||
bucket = module.smart_proxy_{{ group.id }}.config_bucket_name
|
|
||||||
key = "default"
|
|
||||||
source = "smart_proxy.{{ group.id }}.conf"
|
|
||||||
etag = filemd5("smart_proxy.{{ group.id }}.conf")
|
|
||||||
}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
resource "dns_a_record_set" "smart_dns_{{ origin.id }}" {
|
|
||||||
zone = "{{ smart_zone }}"
|
|
||||||
name = "origin-{{ origin.id }}.cloudfront.smart"
|
|
||||||
addresses = module.smart_proxy_{{ origin.group.id }}.ip_addresses
|
|
||||||
ttl = 60
|
|
||||||
}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue