Yandex Cloud
Поиск
Связаться с экспертомПопробовать бесплатно
  • Кейсы
  • Документация
  • Блог
  • Все сервисы
  • Статус работы сервисов
  • Marketplace
    • Популярные
    • Инфраструктура и сеть
    • Платформа данных
    • Искусственный интеллект
    • Безопасность
    • Инструменты DevOps
    • Бессерверные вычисления
    • Управление ресурсами
  • Все решения
    • По отраслям
    • По типу задач
    • Экономика платформы
    • Безопасность
    • Техническая поддержка
    • Каталог партнёров
    • Обучение и сертификация
    • Облако для стартапов
    • Облако для крупного бизнеса
    • Центр технологий для общества
    • Облако для интеграторов
    • Поддержка IT-бизнеса
    • Облако для фрилансеров
    • Обучение и сертификация
    • Блог
    • Документация
    • Контент-программа
    • Мероприятия и вебинары
    • Контакты, чаты и сообщества
    • Идеи
    • Калькулятор цен
    • Тарифы
    • Акции и free tier
  • Кейсы
  • Документация
  • Блог
Создавайте контент и получайте гранты!Готовы написать своё руководство? Участвуйте в контент-программе и получайте гранты на работу с облачными сервисами!
Подробнее о программе
Проект Яндекса
© 2026 ООО «Яндекс.Облако»
Terraform в Yandex Cloud
  • Начало работы
  • Настройка аутентификации Terraform-провайдера Yandex Cloud
  • Библиотека решений
    • Обзор
    • История изменений (англ.)
          • smartcaptcha_captcha

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

  • Example usage
  • Arguments & Attributes Reference
  • Import
  1. Справочник Terraform
  2. Ресурсы (англ.)
  3. Smart Captcha
  4. Resources
  5. smartcaptcha_captcha

yandex_smartcaptcha_captcha (Resource)

Статья создана
Yandex Cloud
Обновлена 25 мая 2026 г.
  • Example usage
  • Arguments & Attributes Reference
  • 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"
  }
}

Arguments & Attributes ReferenceArguments & Attributes Reference

  • 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.
  • client_key (Read-Only) (String). Client key of the captcha, see CAPTCHA keys.
  • cloud_id (String). ID of the cloud that the captcha belongs to.
  • complexity (String). Complexity of the captcha.
  • created_at (Read-Only) (String). Creation timestamp in RFC3339 text format.
  • deletion_protection (Bool). Determines whether captcha is protected from being deleted.
  • description (String). Optional description of the captcha.
  • disallow_data_processing (Bool). Disables the use of HTTP request data for training and improving the service's ML models.
  • folder_id (String). ID of the folder that the captcha belongs to.
  • id (String). ID of the Captcha resource to return.
  • labels (Map Of String). Labels as key:value pairs. Maximum of 64 per resource.
  • name (String). Name of the captcha. The name is unique within the folder. 3-63 characters long.
  • pre_check_type (String). Basic check type of the captcha.
  • style_json (String). JSON with variables to define the captcha appearance. For more details see generated JSON in cloud console.
  • suspend (Read-Only) (Bool). Determines that the captcha is currently in restricted mode, see SmartCaptcha restricted mode.
  • turn_off_hostname_check (Bool). Turn off host name check, see Domain validation.
  • override_variant [Block]. List of variants to use in security_rules
    • 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.
  • security_rule [Block]. List of security rules.
    • description (String). Optional description of the rule. 0-512 characters long.
    • name (Required)(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.
    • condition [Block]. The condition for matching the rule.
      • headers [Block]. Captcha request headers.
        • name (Required)(String). Name of header (case insensitive).
        • value [Block]. Value of the header.
          • exact_match (String). Exact match condition.
          • exact_not_match (String). Exact not match condition.
          • pire_regex_match (String). PIRE regex match condition.
          • pire_regex_not_match (String). PIRE regex not match condition.
          • prefix_match (String). Prefix match condition.
          • prefix_not_match (String). Prefix not match condition.
      • host [Block]. AND semantics implied.
        • host_matcher [Block]. Host matcher.
          • exact_match (String). Exact match condition.
          • exact_not_match (String). Exact not match condition.
          • pire_regex_match (String). PIRE regex match condition.
          • pire_regex_not_match (String). PIRE regex not match condition.
          • prefix_match (String). Prefix match condition.
          • prefix_not_match (String). Prefix not match condition.
        • hosts [Block]. List of hosts. OR semantics implied.
          • exact_match (String). Exact match condition.
          • exact_not_match (String). Exact not match condition.
          • pire_regex_match (String). PIRE regex match condition.
          • pire_regex_not_match (String). PIRE regex not match condition.
          • prefix_match (String). Prefix match condition.
          • prefix_not_match (String). Prefix not match condition.
      • source_ip [Block]. The IP address of the requester.
        • geo_ip_match [Block]. Geo locations to match with.
          • locations (List Of String). *OR semantics implied. ISO 3166-1 alpha 2
        • geo_ip_not_match [Block]. Geo locations to not match with.
          • locations (List Of String). *OR semantics implied. ISO 3166-1 alpha 2
        • ip_ranges_match [Block]. IP ranges to match with.
          • ip_ranges (List Of String). OR semantics implied.
        • ip_ranges_not_match [Block]. IP ranges to not match with.
          • ip_ranges (List Of String). OR semantics implied.
      • uri [Block]. URI where captcha placed.
        • path [Block]. Path of the URI RFC3986.
          • exact_match (String). Exact match condition.
          • exact_not_match (String). Exact not match condition.
          • pire_regex_match (String). PIRE regex match condition.
          • pire_regex_not_match (String). PIRE regex not match condition.
          • prefix_match (String). Prefix match condition.
          • prefix_not_match (String). Prefix not match condition.
        • queries [Block]. AND semantics implied
          • key (Required)(String). Key of the query parameter.
          • value [Block]. Value of the query parameter.
            • exact_match (String). Exact match condition.
            • exact_not_match (String). Exact not match condition.
            • pire_regex_match (String). PIRE regex match condition.
            • pire_regex_not_match (String). PIRE regex not match condition.
            • prefix_match (String). Prefix match condition.
            • prefix_not_match (String). Prefix not match condition.
  • timeouts [Block].
    • 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 it you can use Yandex Cloud Web Console or Yandex Cloud 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
Создавайте контент и получайте гранты!Готовы написать своё руководство? Участвуйте в контент-программе и получайте гранты на работу с облачными сервисами!
Подробнее о программе
Проект Яндекса
© 2026 ООО «Яндекс.Облако»