Yandex Cloud
Search
Contact UsGet started
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • AI Studio
    • Business tools
  • 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
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
© 2025 Direct Cursus Technology L.L.C.
Yandex Smart Web Security
  • Getting started
    • All guides
      • Creating a profile
      • Editing basic profile settings
      • Getting information about a profile
      • Deleting a profile
      • Configuring a basic rule set
      • Adding an exclusion rule
      • Updating an exclusion rule
      • Deleting an exclusion rule
    • Address lists
    • Viewing operations
    • Configuring monitoring
    • Setting up alerts
    • Configuring logging
    • Migrating to WAF with Yandex rule set
    • Overview
    • Security profiles
    • WAF
    • ARL (request limit)
    • Rules
    • Conditions
    • Lists
    • Protecting domains
    • Quotas and limits
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Release notes
  1. Step-by-step guides
  2. WAF profiles
  3. Adding an exclusion rule

Adding a WAF exclusion rule

Written by
Yandex Cloud
Updated at July 29, 2025
Management console
Terraform
API
  1. In the management console, select the folder containing the WAF profile.
  2. In the list of services, select Smart Web Security.
  3. In the left-hand panel, select WAF profiles.
  4. Select the profile where you want to add an exclusion rule.
  5. In the left-hand menu, go to the Exclusion rules tab and click Create exception rule. In the window that opens:
    1. Name the exclusion rule.

    2. Optionally, provide a description.

    3. Optionally, enable Write logs to log exception rule triggering.

    4. Under Scope of use, select rules from the basic set to which the exclusion will apply:

      • All rules: Exclusion will apply to all rules.

      • Selected rules: Exclusion will apply to the selected rules.

        Click Add rules to select rules from the basic set.

    5. Under Traffic conditions, specify the traffic the rule will apply to:

      • All traffic: Rule will apply to all traffic.

      • On condition: Rule will apply to the traffic defined in the Conditions field:

        • IP: IP address, IP address range, or IP address region.
        • HTTP header: HTTP header string.
        • HTTP body: HTTP body string.
        • Request URI: Request path.
        • Host: Domain receiving the request.
        • HTTP method: Request method.
        • Cookie: Cookie header string.

        You can set multiple conditions of the same type by selecting all the condition types you need in the Conditions field.

        You can also set multiple conditions of the same type at the same time by clicking and or or in the section with the condition you need.

        To delete a condition, click .

    6. Click Create.

With Terraform, you can quickly create a cloud infrastructure in Yandex Cloud and manage it using configuration files. These files store the infrastructure description written in HashiCorp Configuration Language (HCL). If you change the configuration files, Terraform automatically detects which part of your configuration is already deployed, and what should be added or removed.

Terraform is distributed under the Business Source License. The Yandex Cloud provider for Terraform is distributed under the MPL-2.0 license.

For more information about the provider resources, see the relevant documentation on the Terraform website or its mirror.

If you do not have Terraform yet, install it and configure the Yandex Cloud provider.

  1. Open the Terraform configuration file and edit the yandex_sws_waf_profile description: add the exclusion_rule section with a WAF exclusion rule.

    # WAF profile
    resource "yandex_sws_waf_profile" "default" {
      name = "waf-profile-default"
      core_rule_set {
        inbound_anomaly_score = 2
        paranoia_level        = local.waf_paranoia_level
        rule_set {
          name    = "OWASP Core Ruleset"
          version = "4.0.0"
        }
      }
    
      ...
    
      # Exclusion rule
      exclusion_rule {
        name = "<exclusion_rule_name>"
        exclude_rules {
          exclude_all = <true_or_false>
          rule_ids    = ["rule_1_ID","rule_2_ID"]
        }
      }
    }
    

    Where:

    • exclusion_rule:
      • name: Exclusion rule name.
      • exclude_rules: Exclusion rule settings:
        • exclude_all: Exclusion will apply to all rules. It can be either false or true.
        • rule_ids: List of IDs of rules from the basic set to which the exclusion will apply. To specify individual rules, set exclude_all to false.

    For more information about sws_waf_profile properties, see this Terraform provider article.

  2. Create the resources:

    1. In the terminal, go to the directory where you edited the configuration file.

    2. Make sure the configuration file is correct using this command:

      terraform validate
      

      If the configuration is correct, you will get this message:

      Success! The configuration is valid.
      
    3. Run this command:

      terraform plan
      

      You will see a detailed list of resources. No changes will be made at this step. If the configuration contains any errors, Terraform will show them.

    4. Apply the changes:

      terraform apply
      
    5. Type yes and press Enter to confirm the changes.

You can check the resource updates in the management console.

Use the update REST API method for the WafProfile resource or the WafProfile/Update gRPC API call.

See alsoSee also

  • Configuring a WAF basic rule set
  • Deleting a WAF exclusion rule
  • Adding a rule to a security profile

Was the article helpful?

Previous
Configuring a basic rule set
Next
Updating an exclusion rule
© 2025 Direct Cursus Technology L.L.C.