|
| 1 | +resource "fastly_service_dictionary_items" "edge_security_dictionary_items" { |
| 2 | + count = var.activate_ngwaf_service ? 1 : 0 |
| 3 | + service_id = fastly_service_vcl.python_org.id |
| 4 | + dictionary_id = one([for d in fastly_service_vcl.python_org.dictionary : d.dictionary_id if d.name == var.edge_security_dictionary]) |
| 5 | + items = { |
| 6 | + Enabled : "100" |
| 7 | + } |
| 8 | +} |
| 9 | + |
| 10 | +resource "fastly_service_dynamic_snippet_content" "ngwaf_config_snippets" { |
| 11 | + for_each = var.activate_ngwaf_service ? toset(["init", "miss", "pass", "deliver"]) : [] |
| 12 | + service_id = fastly_service_vcl.python_org.id |
| 13 | + snippet_id = one([for d in fastly_service_vcl.python_org.dynamicsnippet : d.snippet_id if d.name == "ngwaf_config_${each.key}"]) |
| 14 | + content = "### Terraform managed ngwaf_config_${each.key}" |
| 15 | + manage_snippets = false |
| 16 | +} |
| 17 | + |
| 18 | +# NGWAF Edge Deployment on SignalSciences.net |
| 19 | +resource "sigsci_edge_deployment" "ngwaf_edge_site_service" { |
| 20 | + count = var.activate_ngwaf_service ? 1 : 0 |
| 21 | + provider = sigsci.firewall |
| 22 | + site_short_name = var.ngwaf_site_name |
| 23 | +} |
| 24 | + |
| 25 | +resource "sigsci_edge_deployment_service" "ngwaf_edge_service_link" { |
| 26 | + count = var.activate_ngwaf_service ? 1 : 0 |
| 27 | + provider = sigsci.firewall |
| 28 | + site_short_name = var.ngwaf_site_name |
| 29 | + fastly_sid = fastly_service_vcl.python_org.id |
| 30 | + activate_version = var.activate_ngwaf_service |
| 31 | + percent_enabled = 100 |
| 32 | + depends_on = [ |
| 33 | + sigsci_edge_deployment.ngwaf_edge_site_service, |
| 34 | + fastly_service_vcl.python_org, |
| 35 | + fastly_service_dictionary_items.edge_security_dictionary_items, |
| 36 | + fastly_service_dynamic_snippet_content.ngwaf_config_snippets, |
| 37 | + ] |
| 38 | +} |
| 39 | + |
| 40 | +resource "sigsci_edge_deployment_service_backend" "ngwaf_edge_service_backend_sync" { |
| 41 | + count = var.activate_ngwaf_service ? 1 : 0 |
| 42 | + provider = sigsci.firewall |
| 43 | + site_short_name = var.ngwaf_site_name |
| 44 | + fastly_sid = fastly_service_vcl.python_org.id |
| 45 | + fastly_service_vcl_active_version = fastly_service_vcl.python_org.active_version |
| 46 | + depends_on = [ |
| 47 | + sigsci_edge_deployment_service.ngwaf_edge_service_link, |
| 48 | + ] |
| 49 | +} |
0 commit comments