hashicorp / terraform-provider-google

Terraform Provider for Google Cloud Platform
https://registry.terraform.io/providers/hashicorp/google/latest/docs
Mozilla Public License 2.0
2.29k stars 1.72k forks source link

Add Network Intelligence Center support for Firewall rule insights #12419

Open steencaleb opened 2 years ago

steencaleb commented 2 years ago

Community Note

Description

Currently there is no support for Firewall Insights within Network Intelligence Center - specifically a way to enable or disable "Shadowed" and "Overly permissive" rule insights through Terraform. It would be nice to keep these settings configurable through terraform instead of through the GUI.

New or Affected Resource(s)

google_recommender_insight_type_config

Potential Terraform Configuration

resource "google_compute_firewall" "default"{
          name = "test-firewall"
          network = var.network

          allow {
               protocol = "icmp"
          }

          firewall_insights {
              shadowed = true
              shadowed_observation_period = 7d
              overly_permissive = false
          }
}

References

melinath commented 7 months ago

It looks like this uses the recommender API rather than being related to google_compute_firewall based on https://cloud.google.com/network-intelligence-center/docs/firewall-insights/how-to/configure-observation-period#api Specifically this configuration is controleld by thehttps://cloud.google.com/recommender/docs/reference/rest/v1/projects.locations.insightTypes/getConfig singleton resource.