Yandex Cloud
Search
Contact UsTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
  • Marketplace
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2026 Direct Cursus Technology L.L.C.
Terraform in Yandex Cloud
  • Getting started
  • Solution library
    • Overview
    • Release notes
          • smartcaptcha_captcha

In this article:

  • 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
  1. Terraform reference
  2. Resources
  3. Smart Captcha
  4. Resources
  5. smartcaptcha_captcha

yandex_smartcaptcha_captcha (Resource)

Written by
Yandex Cloud
Updated at February 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 UsageExample 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"
  }
}

SchemaSchema

OptionalOptional

  • 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-OnlyRead-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.proto
  • disallow_data_processing (Boolean) package: yandex.cloud.smartcaptcha.v1
    filename: yandex/cloud/smartcaptcha/v1/captcha.proto
  • labels (Map of String) package: yandex.cloud.smartcaptcha.v1
    filename: yandex/cloud/smartcaptcha/v1/captcha.proto
  • suspend (Boolean) Determines that the captcha is currently in restricted mode, see SmartCaptcha restricted mode.

Nested Schema for 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 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 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 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 Nested Schema for security_rule.condition.headers.value

Optional:

  • exact_match (String) package: yandex.cloud.smartcaptcha.v1
    filename: yandex/cloud/smartcaptcha/v1/captcha.proto
  • exact_not_match (String) package: yandex.cloud.smartcaptcha.v1
    filename: yandex/cloud/smartcaptcha/v1/captcha.proto
  • pire_regex_match (String) package: yandex.cloud.smartcaptcha.v1
    filename: yandex/cloud/smartcaptcha/v1/captcha.proto
  • pire_regex_not_match (String) package: yandex.cloud.smartcaptcha.v1
    filename: yandex/cloud/smartcaptcha/v1/captcha.proto
  • prefix_match (String) package: yandex.cloud.smartcaptcha.v1
    filename: yandex/cloud/smartcaptcha/v1/captcha.proto
  • prefix_not_match (String) package: yandex.cloud.smartcaptcha.v1
    filename: yandex/cloud/smartcaptcha/v1/captcha.proto

Nested Schema for 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 Nested Schema for security_rule.condition.host.hosts

Optional:

  • exact_match (String) package: yandex.cloud.smartcaptcha.v1
    filename: yandex/cloud/smartcaptcha/v1/captcha.proto
  • exact_not_match (String) package: yandex.cloud.smartcaptcha.v1
    filename: yandex/cloud/smartcaptcha/v1/captcha.proto
  • pire_regex_match (String) package: yandex.cloud.smartcaptcha.v1
    filename: yandex/cloud/smartcaptcha/v1/captcha.proto
  • pire_regex_not_match (String) package: yandex.cloud.smartcaptcha.v1
    filename: yandex/cloud/smartcaptcha/v1/captcha.proto
  • prefix_match (String) package: yandex.cloud.smartcaptcha.v1
    filename: yandex/cloud/smartcaptcha/v1/captcha.proto
  • prefix_not_match (String) package: yandex.cloud.smartcaptcha.v1
    filename: yandex/cloud/smartcaptcha/v1/captcha.proto

Nested Schema for 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 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 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 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 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 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 Nested Schema for security_rule.condition.uri.path

Optional:

  • exact_match (String) package: yandex.cloud.smartcaptcha.v1
    filename: yandex/cloud/smartcaptcha/v1/captcha.proto
  • exact_not_match (String) package: yandex.cloud.smartcaptcha.v1
    filename: yandex/cloud/smartcaptcha/v1/captcha.proto
  • pire_regex_match (String) package: yandex.cloud.smartcaptcha.v1
    filename: yandex/cloud/smartcaptcha/v1/captcha.proto
  • pire_regex_not_match (String) package: yandex.cloud.smartcaptcha.v1
    filename: yandex/cloud/smartcaptcha/v1/captcha.proto
  • prefix_match (String) package: yandex.cloud.smartcaptcha.v1
    filename: yandex/cloud/smartcaptcha/v1/captcha.proto
  • prefix_not_match (String) package: yandex.cloud.smartcaptcha.v1
    filename: yandex/cloud/smartcaptcha/v1/captcha.proto

Nested Schema for 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 Nested Schema for security_rule.condition.uri.queries.value

Optional:

  • exact_match (String) package: yandex.cloud.smartcaptcha.v1
    filename: yandex/cloud/smartcaptcha/v1/captcha.proto
  • exact_not_match (String) package: yandex.cloud.smartcaptcha.v1
    filename: yandex/cloud/smartcaptcha/v1/captcha.proto
  • pire_regex_match (String) package: yandex.cloud.smartcaptcha.v1
    filename: yandex/cloud/smartcaptcha/v1/captcha.proto
  • pire_regex_not_match (String) package: yandex.cloud.smartcaptcha.v1
    filename: yandex/cloud/smartcaptcha/v1/captcha.proto
  • prefix_match (String) package: yandex.cloud.smartcaptcha.v1
    filename: yandex/cloud/smartcaptcha/v1/captcha.proto
  • prefix_not_match (String) package: yandex.cloud.smartcaptcha.v1
    filename: yandex/cloud/smartcaptcha/v1/captcha.proto

Nested Schema for 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).

ImportImport

The resource can be imported by using their resource ID. For getting the resource ID you can use Yandex Cloud Web Console or YC CLI.

# terraform import yandex_smartcaptcha_captcha.<resource Name> <resource Id>
terraform import yandex_smartcaptcha_captcha.demo-captcha-simple ...

Was the article helpful?

Previous
smartcaptcha_captcha
Next
sws_advanced_rate_limiter_profile
© 2026 Direct Cursus Technology L.L.C.