yandex_smartcaptcha_captcha (Resource)
Статья создана
Обновлена 2 февраля 2026 г.
- Example Usage
- Schema
- Optional
- Read-Only
- Nested Schema for override_variant
- Nested Schema for security_rule
- Nested Schema for security_rule.condition
- Nested Schema for security_rule.condition.headers
- Nested Schema for security_rule.condition.headers.value
- Nested Schema for security_rule.condition.host
- Nested Schema for security_rule.condition.host.hosts
- Nested Schema for security_rule.condition.source_ip
- Nested Schema for security_rule.condition.source_ip.geo_ip_match
- Nested Schema for security_rule.condition.source_ip.geo_ip_not_match
- Nested Schema for security_rule.condition.source_ip.ip_ranges_match
- Nested Schema for security_rule.condition.source_ip.ip_ranges_not_match
- Nested Schema for security_rule.condition.uri
- Nested Schema for security_rule.condition.uri.path
- Nested Schema for security_rule.condition.uri.queries
- Nested Schema for security_rule.condition.uri.queries.value
- Nested Schema for timeouts
- Import
A Captcha resource.
Example Usage
//
// Simple SmartCaptcha example.
//
resource "yandex_smartcaptcha_captcha" "demo-captcha-simple" {
deletion_protection = true
name = "demo-captcha-simple"
complexity = "HARD"
pre_check_type = "SLIDER"
challenge_type = "IMAGE_TEXT"
allowed_sites = [
"example.com",
"example.ru"
]
}
//
// Advanced SmartCaptcha example.
//
resource "yandex_smartcaptcha_captcha" "demo-captcha-advanced" {
deletion_protection = true
name = "demo-captcha-advanced"
complexity = "HARD"
pre_check_type = "SLIDER"
challenge_type = "IMAGE_TEXT"
allowed_sites = [
"example.com",
"example.ru"
]
override_variant {
uuid = "xxx"
description = "override variant 1"
complexity = "EASY"
pre_check_type = "CHECKBOX"
challenge_type = "SILHOUETTES"
}
override_variant {
uuid = "yyy"
description = "override variant 2"
complexity = "HARD"
pre_check_type = "CHECKBOX"
challenge_type = "KALEIDOSCOPE"
}
security_rule {
name = "rule1"
priority = 11
description = "My first security rule. This rule it's just example to show possibilities of configuration."
override_variant_uuid = "xxx"
condition {
host {
hosts {
exact_match = "example.com"
}
hosts {
exact_match = "example.net"
}
}
uri {
path {
prefix_match = "/form"
}
queries {
key = "firstname"
value {
pire_regex_match = ".*ivan.*"
}
}
queries {
key = "lastname"
value {
pire_regex_match = ".*petr.*"
}
}
}
headers {
name = "User-Agent"
value {
pire_regex_match = ".*curl.*"
}
}
headers {
name = "Referer"
value {
pire_regex_not_match = ".*bot.*"
}
}
source_ip {
ip_ranges_match {
ip_ranges = ["1.2.33.44", "2.3.4.56"]
}
ip_ranges_not_match {
ip_ranges = ["8.8.0.0/16", "10::1234:1abc:1/64"]
}
geo_ip_match {
locations = ["ru", "es"]
}
geo_ip_not_match {
locations = ["us", "fm", "gb"]
}
}
}
}
security_rule {
name = "rule2"
priority = 555
description = "Second rule"
override_variant_uuid = "yyy"
condition {
uri {
path {
prefix_match = "/form"
}
}
}
}
security_rule {
name = "rule3"
priority = 99999
description = "Empty condition rule"
override_variant_uuid = "yyy"
}
}
Schema
Optional
allowed_sites(List of String) List of allowed host names, see Domain validation.captcha_id(String) ID of the Captcha resource to return.challenge_type(String) Additional task type of the captcha.cloud_id(String) ID of the cloud that the captcha belongs to.complexity(String) Complexity of the captcha.deletion_protection(Boolean) Determines whether captcha is protected from being deleted.folder_id(String) ID of the folder that the captcha belongs to.id(String) ID of the Captcha resource to return.name(String) Name of the captcha. The name is unique within the folder. 3-63 characters long.override_variant(Block List) List of variants to use in security_rules (see below for nested schema)pre_check_type(String) Basic check type of the captcha.security_rule(Block List) List of security rules. (see below for nested schema)style_json(String) JSON with variables to define the captcha appearance. For more details see generated JSON in cloud console.timeouts(Attributes) (see below for nested schema)turn_off_hostname_check(Boolean) Turn off host name check, see Domain validation.
Read-Only
client_key(String) Client key of the captcha, see CAPTCHA keys.created_at(String) Creation timestamp in RFC3339 text format.description(String) package: yandex.cloud.smartcaptcha.v1
filename: yandex/cloud/smartcaptcha/v1/captcha.protodisallow_data_processing(Boolean) package: yandex.cloud.smartcaptcha.v1
filename: yandex/cloud/smartcaptcha/v1/captcha.protolabels(Map of String) package: yandex.cloud.smartcaptcha.v1
filename: yandex/cloud/smartcaptcha/v1/captcha.protosuspend(Boolean) Determines that the captcha is currently in restricted mode, see SmartCaptcha restricted mode.
Nested Schema for override_variant
Optional:
challenge_type(String) Additional task type of the captcha.complexity(String) Complexity of the captcha.description(String) Optional description of the rule. 0-512 characters long.pre_check_type(String) Basic check type of the captcha.uuid(String) Unique identifier of the variant.
Nested Schema for security_rule
Required:
name(String) Name of the rule. The name is unique within the captcha. 1-50 characters long.
Optional:
condition(Attributes List) The condition for matching the rule. (see below for nested schema)description(String) Optional description of the rule. 0-512 characters long.override_variant_uuid(String) Variant UUID to show in case of match the rule. Keep empty to use defaults.priority(Number) Priority of the rule. Lower value means higher priority.
Nested Schema for security_rule.condition
Optional:
headers(Attributes List) Captcha request headers. (see below for nested schema)host(Attributes List) Host where captcha placed. (see below for nested schema)source_ip(Attributes List) The IP address of the requester. (see below for nested schema)uri(Attributes List) URI where captcha placed. (see below for nested schema)
Nested Schema for security_rule.condition.headers
Required:
name(String) Name of header (case insensitive).value(Attributes List) Value of the header. (see below for nested schema)
Nested Schema for security_rule.condition.headers.value
Optional:
exact_match(String) package: yandex.cloud.smartcaptcha.v1
filename: yandex/cloud/smartcaptcha/v1/captcha.protoexact_not_match(String) package: yandex.cloud.smartcaptcha.v1
filename: yandex/cloud/smartcaptcha/v1/captcha.protopire_regex_match(String) package: yandex.cloud.smartcaptcha.v1
filename: yandex/cloud/smartcaptcha/v1/captcha.protopire_regex_not_match(String) package: yandex.cloud.smartcaptcha.v1
filename: yandex/cloud/smartcaptcha/v1/captcha.protoprefix_match(String) package: yandex.cloud.smartcaptcha.v1
filename: yandex/cloud/smartcaptcha/v1/captcha.protoprefix_not_match(String) package: yandex.cloud.smartcaptcha.v1
filename: yandex/cloud/smartcaptcha/v1/captcha.proto
Nested Schema for security_rule.condition.host
Optional:
hosts(Attributes List) List of hosts. OR semantics implied. (see below for nested schema)
Nested Schema for security_rule.condition.host.hosts
Optional:
exact_match(String) package: yandex.cloud.smartcaptcha.v1
filename: yandex/cloud/smartcaptcha/v1/captcha.protoexact_not_match(String) package: yandex.cloud.smartcaptcha.v1
filename: yandex/cloud/smartcaptcha/v1/captcha.protopire_regex_match(String) package: yandex.cloud.smartcaptcha.v1
filename: yandex/cloud/smartcaptcha/v1/captcha.protopire_regex_not_match(String) package: yandex.cloud.smartcaptcha.v1
filename: yandex/cloud/smartcaptcha/v1/captcha.protoprefix_match(String) package: yandex.cloud.smartcaptcha.v1
filename: yandex/cloud/smartcaptcha/v1/captcha.protoprefix_not_match(String) package: yandex.cloud.smartcaptcha.v1
filename: yandex/cloud/smartcaptcha/v1/captcha.proto
Nested Schema for security_rule.condition.source_ip
Optional:
geo_ip_match(Attributes List) package: yandex.cloud.smartcaptcha.v1
filename: yandex/cloud/smartcaptcha/v1/captcha.proto (see below for nested schema)geo_ip_not_match(Attributes List) package: yandex.cloud.smartcaptcha.v1
filename: yandex/cloud/smartcaptcha/v1/captcha.proto (see below for nested schema)ip_ranges_match(Attributes List) package: yandex.cloud.smartcaptcha.v1
filename: yandex/cloud/smartcaptcha/v1/captcha.proto (see below for nested schema)ip_ranges_not_match(Attributes List) package: yandex.cloud.smartcaptcha.v1
filename: yandex/cloud/smartcaptcha/v1/captcha.proto (see below for nested schema)
Nested Schema for security_rule.condition.source_ip.geo_ip_match
Optional:
locations(List of String) ISO 3166-1 alpha 2. OR semantics implied.
Nested Schema for security_rule.condition.source_ip.geo_ip_not_match
Optional:
locations(List of String) ISO 3166-1 alpha 2. OR semantics implied.
Nested Schema for security_rule.condition.source_ip.ip_ranges_match
Optional:
ip_ranges(List of String) List of IP ranges. OR semantics implied.
Nested Schema for security_rule.condition.source_ip.ip_ranges_not_match
Optional:
ip_ranges(List of String) List of IP ranges. OR semantics implied.
Nested Schema for security_rule.condition.uri
Optional:
path(Attributes List) Path of the URI RFC3986 . (see below for nested schema)queries(Attributes List) List of query matchers. AND semantics implied. (see below for nested schema)
Nested Schema for security_rule.condition.uri.path
Optional:
exact_match(String) package: yandex.cloud.smartcaptcha.v1
filename: yandex/cloud/smartcaptcha/v1/captcha.protoexact_not_match(String) package: yandex.cloud.smartcaptcha.v1
filename: yandex/cloud/smartcaptcha/v1/captcha.protopire_regex_match(String) package: yandex.cloud.smartcaptcha.v1
filename: yandex/cloud/smartcaptcha/v1/captcha.protopire_regex_not_match(String) package: yandex.cloud.smartcaptcha.v1
filename: yandex/cloud/smartcaptcha/v1/captcha.protoprefix_match(String) package: yandex.cloud.smartcaptcha.v1
filename: yandex/cloud/smartcaptcha/v1/captcha.protoprefix_not_match(String) package: yandex.cloud.smartcaptcha.v1
filename: yandex/cloud/smartcaptcha/v1/captcha.proto
Nested Schema for security_rule.condition.uri.queries
Required:
key(String) Key of the query parameter.value(Attributes List) Value of the query parameter. (see below for nested schema)
Nested Schema for security_rule.condition.uri.queries.value
Optional:
exact_match(String) package: yandex.cloud.smartcaptcha.v1
filename: yandex/cloud/smartcaptcha/v1/captcha.protoexact_not_match(String) package: yandex.cloud.smartcaptcha.v1
filename: yandex/cloud/smartcaptcha/v1/captcha.protopire_regex_match(String) package: yandex.cloud.smartcaptcha.v1
filename: yandex/cloud/smartcaptcha/v1/captcha.protopire_regex_not_match(String) package: yandex.cloud.smartcaptcha.v1
filename: yandex/cloud/smartcaptcha/v1/captcha.protoprefix_match(String) package: yandex.cloud.smartcaptcha.v1
filename: yandex/cloud/smartcaptcha/v1/captcha.protoprefix_not_match(String) package: yandex.cloud.smartcaptcha.v1
filename: yandex/cloud/smartcaptcha/v1/captcha.proto
Nested Schema for timeouts
Optional:
create(String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).delete(String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.read(String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Read operations occur during any refresh or planning operation when refresh is enabled.update(String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
Import
The resource can be imported by using their resource ID. For getting the resource ID you can use Yandex Cloud Web Console
# terraform import yandex_smartcaptcha_captcha.<resource Name> <resource Id>
terraform import yandex_smartcaptcha_captcha.demo-captcha-simple ...