Created
February 3, 2021 09:49
-
-
Save acondrat/d552309460b47eb9e1175b8625df4d1f to your computer and use it in GitHub Desktop.
victoriametrics security policy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "google_compute_security_policy" "victoriametrics" { | |
name = "victoriametrics" | |
rule { | |
action = "allow" | |
priority = "1000" | |
match { | |
expr { | |
# Querying from nat IP of the k8s cluster | |
# https://github.com/VictoriaMetrics/VictoriaMetrics/tree/cluster#url-format | |
expression = "request.path.matches('^/api/v1/query|^/api/v1/series|^/api/v1/label') && (inIpRange(origin.ip, 'x.x.x.x/32'))" | |
} | |
} | |
description = "Allow querying api from nat IP of the k8s cluster" | |
} | |
rule { | |
action = "deny(404)" | |
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