{% set config = merged_configs.get('google_compute_firewall', {}) %}
# Compliance: {{ compliance_comments.get('google_compute_firewall', []) | join(', ') }}
resource "google_compute_firewall" "main" {
  name    = "{{ config.get('name', '${var.project_id}-fw-allow-internal') }}"
  project = var.project_id
  network = google_compute_network.main.name

  direction = "{{ config.get('direction', 'INGRESS') }}"
  priority  = {{ config.get('priority', 1000) }}

  source_ranges = {{ config.get('source_ranges', '["10.0.0.0/8"]') }}

  allow {
    protocol = "{{ config.get('protocol', 'tcp') }}"
    ports    = {{ config.get('ports', '["443"]') }}
  }

  log_config {
    metadata = "{{ config.get('log_metadata', 'INCLUDE_ALL_METADATA') }}"
  }
}
