Yandex Cloud
Поиск
Связаться с намиПодключиться
  • Истории успеха
  • Документация
  • Блог
  • Все сервисы
  • Статус работы сервисов
    • Популярные
    • Инфраструктура и сеть
    • Платформа данных
    • Контейнеры
    • Инструменты разработчика
    • Бессерверные вычисления
    • Безопасность
    • Мониторинг и управление ресурсами
    • AI Studio
    • Бизнес-инструменты
  • Все решения
    • По отраслям
    • По типу задач
    • Экономика платформы
    • Безопасность
    • Техническая поддержка
    • Каталог партнёров
    • Обучение и сертификация
    • Облако для стартапов
    • Облако для крупного бизнеса
    • Центр технологий для общества
    • Облако для интеграторов
    • Поддержка IT-бизнеса
    • Облако для фрилансеров
    • Обучение и сертификация
    • Блог
    • Документация
    • Контент-программа
    • Мероприятия и вебинары
    • Контакты, чаты и сообщества
    • Идеи
    • Тарифы Yandex Cloud
    • Промоакции и free tier
    • Правила тарификации
  • Истории успеха
  • Документация
  • Блог
Проект Яндекса
© 2025 ООО «Яндекс.Облако»
Terraform в Yandex Cloud
  • Начало работы
  • Библиотека решений
    • Обзор
    • История изменений
          • smartcaptcha_captcha

В этой статье:

  • 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
  2. Ресурсы
  3. Smart Captcha
  4. Resources
  5. smartcaptcha_captcha

yandex_smartcaptcha_captcha (Resource)

Статья создана
Yandex Cloud
Обновлена 18 июля 2025 г.
  • 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

Creates a Captcha in the specified folder. For more information, see the official documentation.

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.
  • challenge_type (String) Additional task type of the captcha. Possible values:
  • IMAGE_TEXT - Text recognition: The user has to type a distorted text from the picture into a special field.
  • SILHOUETTES - Silhouettes: The user has to mark several icons from the picture in a particular order.
  • KALEIDOSCOPE - Kaleidoscope: The user has to build a picture from individual parts by shuffling them using a slider.
  • cloud_id (String) The Cloud ID which resource belongs to. If it is not provided, the default provider cloud-id is used.
  • complexity (String) Complexity of the captcha. Possible values:
  • EASY - High chance to pass pre-check and easy advanced challenge.
  • MEDIUM - Medium chance to pass pre-check and normal advanced challenge.
  • HARD - Little chance to pass pre-check and hard advanced challenge.
  • FORCE_HARD - Impossible to pass pre-check and hard advanced challenge.
  • deletion_protection (Boolean) The true value means that resource is protected from accidental deletion.
  • folder_id (String) The folder identifier that resource belongs to. If it is not provided, the default provider folder-id is used.
  • name (String) The resource name.
  • 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.Possible values:
  • CHECKBOX - User must click the 'I am not a robot' button.
  • SLIDER - User must move the slider from left to right.
  • 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 (Block, Optional) (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) The creation timestamp of the resource.
  • id (String) The ID of this resource.
  • suspend (Boolean)

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

Optional:

  • condition (Block List, Max: 1) The condition for matching the rule. You can find all possibilities of condition in gRPC specs. (see below for nested schema)
  • description (String) Description of the rule. 0-512 characters long.
  • name (String) Name of the rule. The name is unique within the captcha. 1-50 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 (Block List) (see below for nested schema)
  • host (Block List, Max: 1) (see below for nested schema)
  • source_ip (Block List, Max: 1) (see below for nested schema)
  • uri (Block List, Max: 1) (see below for nested schema)

Nested Schema for Nested Schema for security_rule.condition.headers

Required:

  • value (Block List, Min: 1, Max: 1) (see below for nested schema)

Optional:

  • name (String)

Nested Schema for Nested Schema for security_rule.condition.headers.value

Optional:

  • exact_match (String)
  • exact_not_match (String)
  • pire_regex_match (String)
  • pire_regex_not_match (String)
  • prefix_match (String)
  • prefix_not_match (String)

Nested Schema for Nested Schema for security_rule.condition.host

Optional:

  • hosts (Block List) (see below for nested schema)

Nested Schema for Nested Schema for security_rule.condition.host.hosts

Optional:

  • exact_match (String)
  • exact_not_match (String)
  • pire_regex_match (String)
  • pire_regex_not_match (String)
  • prefix_match (String)
  • prefix_not_match (String)

Nested Schema for Nested Schema for security_rule.condition.source_ip

Optional:

  • geo_ip_match (Block List, Max: 1) (see below for nested schema)
  • geo_ip_not_match (Block List, Max: 1) (see below for nested schema)
  • ip_ranges_match (Block List, Max: 1) (see below for nested schema)
  • ip_ranges_not_match (Block List, Max: 1) (see below for nested schema)

Nested Schema for Nested Schema for security_rule.condition.source_ip.geo_ip_match

Optional:

  • locations (List of String)

Nested Schema for Nested Schema for security_rule.condition.source_ip.geo_ip_not_match

Optional:

  • locations (List of String)

Nested Schema for Nested Schema for security_rule.condition.source_ip.ip_ranges_match

Optional:

  • ip_ranges (List of String)

Nested Schema for Nested Schema for security_rule.condition.source_ip.ip_ranges_not_match

Optional:

  • ip_ranges (List of String)

Nested Schema for Nested Schema for security_rule.condition.uri

Optional:

  • path (Block List, Max: 1) (see below for nested schema)
  • queries (Block List) (see below for nested schema)

Nested Schema for Nested Schema for security_rule.condition.uri.path

Optional:

  • exact_match (String)
  • exact_not_match (String)
  • pire_regex_match (String)
  • pire_regex_not_match (String)
  • prefix_match (String)
  • prefix_not_match (String)

Nested Schema for Nested Schema for security_rule.condition.uri.queries

Required:

  • key (String)
  • value (Block List, Min: 1, Max: 1) (see below for nested schema)

Nested Schema for Nested Schema for security_rule.condition.uri.queries.value

Optional:

  • exact_match (String)
  • exact_not_match (String)
  • pire_regex_match (String)
  • pire_regex_not_match (String)
  • prefix_match (String)
  • prefix_not_match (String)

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 ...

Была ли статья полезна?

Предыдущая
smartcaptcha_captcha
Следующая
sws_advanced_rate_limiter_profile
Проект Яндекса
© 2025 ООО «Яндекс.Облако»