google::compute-security-policy¶
Creates a security policy.
Example¶
google::compute-security-policy security-policy-example
name: "security-policy-example"
description: "security-policy-example-desc"
rule
description: "security-policy-example-rule-desc"
priority: 2
action: 'allow'
preview: true
match
versioned-expr: 'SRC_IPS_V1'
config
src-ip-ranges: ['*']
end
end
end
end
Example full scope¶
google::compute-security-policy security-policy-example
name: "security-policy-example"
description: "security-policy-example-desc"
adaptive-protection-config
enabled: true
rule-visibility: 'STANDARD'
end
rule
description: "allow-rule-match-ip-example"
priority: 2
action: 'allow'
preview: true
match
versioned-expr: 'SRC_IPS_V1'
config
src-ip-ranges: ['1.1.1.0/24']
end
end
end
rule
description: "allow-rule-match-expression-example"
priority: 3
action: 'allow'
match
expression-config
expression: "origin.asn == 1234"
end
end
end
rule
description: "allow-rule-match-expression-with-headers-example"
priority: 4
action: 'allow'
match
expression-config
expression: "origin.asn == 1234"
end
end
header-action
headers: {
'X-Goog-Test' : 'test',
'X-Goog-Test2' : 'test2'
}
end
end
rule
description: "redirect-rule-google-captcha-example"
priority: 5
action: 'redirect'
match
expression-config
expression: "origin.asn == 1234"
end
end
redirect-config
type: 'GOOGLE_RECAPTCHA'
end
end
rule
description: "redirect-rule-external-address-example"
priority: 6
action: 'redirect'
match
expression-config
expression: "origin.asn == 1234"
end
end
redirect-config
type: 'EXTERNAL_302'
target: 'https://www.google.com'
end
end
rule
description: "throttle-rule-example"
priority: 7
action: 'throttle'
match
versioned-expr: 'SRC_IPS_V1'
config
src-ip-ranges: ['1.1.1.0/24']
end
end
rate-limit-config
rate-limit-threshold
count: 10
interval-sec: 120
end
exceed-action: 'deny(403)'
end
end
rule
description: "rate-based-ban-rule-example"
priority: 8
action: 'rate_based_ban'
match
versioned-expr: 'SRC_IPS_V1'
config
src-ip-ranges: ['1.1.1.0/24']
end
end
rate-limit-config
rate-limit-threshold
count: 10
interval-sec: 60
end
ban-threshold
count: 10
interval-sec: 60
end
ban-duration-sec: 120
exceed-action: 'deny(429)'
end
end
end
Attributes¶
Attribute | Description |
---|---|
name | The name of the security policy. Must be a string 1-63 characters long and the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. Valid values satisfy the regex: [(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))] . (Required) |
description | The description of the security policy. |
rule list subresource | The rule of the security policy.
|
fingerprint | The fingerprint for this security policy. |
adaptive-protection-config subresource | Adaptive protection config for this security policy.
|
advanced-options-config subresource | Advanced option config for this security policy.
|
security-policy-type | The type of the security policy. Valid values are CLOUD_ARMOR , CLOUD_ARMOR_EDGE , CLOUD_ARMOR_INTERNAL_SERVICE or CLOUD_ARMOR_NETWORK . (Required) |
Outputs¶
Attribute | Description |
---|---|
self-link | The fully-qualified URL of the security policy. |
default-rule subresource | The default rule for this security policy. |