Skip to content

Instantly share code, notes, and snippets.

@Tensho
Last active October 25, 2024 15:02
Show Gist options
  • Save Tensho/924eefb126ee1f38c60c46988eed12a8 to your computer and use it in GitHub Desktop.
Save Tensho/924eefb126ee1f38c60c46988eed12a8 to your computer and use it in GitHub Desktop.
Terrafrom Google Provider - Cloud Armor (Compute) Security Policy Rules Drift
terraform {
required_providers {
google = {
source = "hashicorp/google"
version = "~> 6.8"
}
}
}
resource "google_compute_security_policy" "default" {
name = "test"
description = "https://github.com/GoogleCloudPlatform/terraform-google-cloud-armor/issues/136"
rule {
action = "deny(403)"
priority = "1000"
match {
versioned_expr = "SRC_IPS_V1"
config {
src_ip_ranges = ["1.1.1.1/32"]
}
}
description = "Deny access to IPs in 1.1.1.1/32"
}
rule {
action = "deny(403)"
priority = "2000"
match {
versioned_expr = "SRC_IPS_V1"
config {
src_ip_ranges = ["22.22.22.22/32"]
}
}
description = "Deny access to IPs in 22.22.22.22/32"
}
rule {
action = "allow"
priority = "2147483647"
match {
versioned_expr = "SRC_IPS_V1"
config {
src_ip_ranges = ["*"]
}
}
description = "Default rule"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment