oracle.oci.oci_waf_web_app_firewall_policy – Manage a WebAppFirewallPolicy resource in Oracle Cloud Infrastructure

Note

This plugin is part of the oracle.oci collection (version 4.11.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install oracle.oci.

To use it in a playbook, specify: oracle.oci.oci_waf_web_app_firewall_policy.

New in version 2.9.0: of oracle.oci

Synopsis

  • This module allows the user to create, update and delete a WebAppFirewallPolicy resource in Oracle Cloud Infrastructure

  • For state=present, creates a new WebAppFirewallPolicy.

  • This resource has the following action operations in the oracle.oci.oci_waf_web_app_firewall_policy_actions module: change_compartment.

Requirements

The below requirements are needed on the host that executes this module.

Parameters

Parameter Choices/Defaults Comments
actions
list / elements=dictionary
Predefined actions for use in multiple different rules. Not all actions are supported in every module. Some actions terminate further execution of modules and rules in a module and some do not. Actions names must be unique within this array.
This parameter is updatable.
body
dictionary
Applicable when type is 'RETURN_HTTP_RESPONSE'
text
string / required
Static response body text.
type
string / required
    Choices:
  • STATIC_TEXT
Type of HttpResponseBody.
code
integer
Response code.
The following response codes are valid values for this property:
* 2xx
200 OK 201 Created 202 Accepted 206 Partial Content
* 3xx
300 Multiple Choices 301 Moved Permanently 302 Found 303 See Other 307 Temporary Redirect
* 4xx
400 Bad Request 401 Unauthorized 403 Forbidden 404 Not Found 405 Method Not Allowed 408 Request Timeout 409 Conflict 411 Length Required 412 Precondition Failed 413 Payload Too Large 414 URI Too Long 415 Unsupported Media Type 416 Range Not Satisfiable 422 Unprocessable Entity 429 Too Many Requests 494 Request Header Too Large 495 Cert Error 496 No Cert 497 HTTP to HTTPS
* 5xx
500 Internal Server Error 501 Not Implemented 502 Bad Gateway 503 Service Unavailable 504 Gateway Timeout 507 Insufficient Storage
Example: `200`
Required when type is 'RETURN_HTTP_RESPONSE'
headers
list / elements=dictionary
Adds headers defined in this array for HTTP response.
Hop-by-hop headers are not allowed to be set:
* Connection * Keep-Alive * Proxy-Authenticate * Proxy-Authorization * TE * Trailer * Transfer-Encoding * Upgrade
Applicable when type is 'RETURN_HTTP_RESPONSE'
name
string / required
The name of the header field.
Required when type is 'RETURN_HTTP_RESPONSE'
value
string / required
The value of the header field.
Required when type is 'RETURN_HTTP_RESPONSE'
name
string / required
Action name. Can be used to reference the action.
type
string / required
    Choices:
  • RETURN_HTTP_RESPONSE
  • ALLOW
  • CHECK
* **CHECK** is a non-terminating action that does not stop the execution of rules in current module, just emits a log message documenting result of rule execution.
* **ALLOW** is a non-terminating action which upon matching rule skips all remaining rules in the current module.
* **RETURN_HTTP_RESPONSE** is a terminating action which is executed immediately, returns a defined HTTP response.
api_user
string
The OCID of the user, on whose behalf, OCI APIs are invoked. If not set, then the value of the OCI_USER_ID environment variable, if any, is used. This option is required if the user is not specified through a configuration file (See config_file_location). To get the user's OCID, please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm.
api_user_fingerprint
string
Fingerprint for the key pair being used. If not set, then the value of the OCI_USER_FINGERPRINT environment variable, if any, is used. This option is required if the key fingerprint is not specified through a configuration file (See config_file_location). To get the key pair's fingerprint value please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm.
api_user_key_file
string
Full path and filename of the private key (in PEM format). If not set, then the value of the OCI_USER_KEY_FILE variable, if any, is used. This option is required if the private key is not specified through a configuration file (See config_file_location). If the key is encrypted with a pass-phrase, the api_user_key_pass_phrase option must also be provided.
api_user_key_pass_phrase
string
Passphrase used by the key referenced in api_user_key_file, if it is encrypted. If not set, then the value of the OCI_USER_KEY_PASS_PHRASE variable, if any, is used. This option is required if the key passphrase is not specified through a configuration file (See config_file_location).
auth_purpose
string
    Choices:
  • service_principal
The auth purpose which can be used in conjunction with 'auth_type=instance_principal'. The default auth_purpose for instance_principal is None.
auth_type
string
    Choices:
  • api_key ←
  • instance_principal
  • instance_obo_user
  • resource_principal
The type of authentication to use for making API requests. By default auth_type="api_key" based authentication is performed and the API key (see api_user_key_file) in your config file will be used. If this 'auth_type' module option is not specified, the value of the OCI_ANSIBLE_AUTH_TYPE, if any, is used. Use auth_type="instance_principal" to use instance principal based authentication when running ansible playbooks within an OCI compute instance.
cert_bundle
string
The full path to a CA certificate bundle to be used for SSL verification. This will override the default CA certificate bundle. If not set, then the value of the OCI_ANSIBLE_CERT_BUNDLE variable, if any, is used.
compartment_id
string
The OCID of the compartment.
Required for create using state=present.
Required for update when environment variable OCI_USE_NAME_AS_IDENTIFIER is set.
Required for delete when environment variable OCI_USE_NAME_AS_IDENTIFIER is set.
config_file_location
string
Path to configuration file. If not set then the value of the OCI_CONFIG_FILE environment variable, if any, is used. Otherwise, defaults to ~/.oci/config.
config_profile_name
string
The profile to load from the config file referenced by config_file_location. If not set, then the value of the OCI_CONFIG_PROFILE environment variable, if any, is used. Otherwise, defaults to the "DEFAULT" profile in config_file_location.
defined_tags
dictionary
Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{"foo-namespace": {"bar-key": "value"}}`
This parameter is updatable.
display_name
string
WebAppFirewallPolicy display name, can be renamed.
Required for create, update, delete when environment variable OCI_USE_NAME_AS_IDENTIFIER is set.
This parameter is updatable when OCI_USE_NAME_AS_IDENTIFIER is not set.

aliases: name
force_create
boolean
    Choices:
  • no ←
  • yes
Whether to attempt non-idempotent creation of a resource. By default, create resource is an idempotent operation, and doesn't create the resource if it already exists. Setting this option to true, forcefully creates a copy of the resource, even if it already exists.This option is mutually exclusive with key_by.
freeform_tags
dictionary
Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{"bar-key": "value"}`
This parameter is updatable.
key_by
list / elements=string
The list of attributes of this resource which should be used to uniquely identify an instance of the resource. By default, all the attributes of a resource are used to uniquely identify a resource.
region
string
The Oracle Cloud Infrastructure region to use for all OCI API requests. If not set, then the value of the OCI_REGION variable, if any, is used. This option is required if the region is not specified through a configuration file (See config_file_location). Please refer to https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm for more information on OCI regions.
request_access_control
dictionary
This parameter is updatable.
default_action_name
string / required
References an default Action to take if no AccessControlRule was matched. Allowed action types:
* **ALLOW** continues execution of other modules and their rules.
* **RETURN_HTTP_RESPONSE** terminates further execution of modules and rules and returns defined HTTP response.
rules
list / elements=dictionary
Ordered list of AccessControlRules. Rules are executed in order of appearance in this array.
action_name
string / required
References action by name from actions defined in WebAppFirewallPolicy.
condition
string
An expression that determines whether or not the rule action should be executed.
condition_language
string
    Choices:
  • JMESPATH
The language used to parse condition from field `condition`. Available languages:
* **JMESPATH** an extended JMESPath language syntax.
name
string / required
Rule name. Must be unique within the module.
type
string / required
    Choices:
  • ACCESS_CONTROL
  • PROTECTION
  • REQUEST_RATE_LIMITING
Type of WebAppFirewallPolicyRule.
request_protection
dictionary
This parameter is updatable.
body_inspection_size_limit_exceeded_action_name
string
References action by name from actions defined in WebAppFirewallPolicy. Executed if HTTP message body size exceeds limit set in field `bodyInspectionSizeLimitInBytes`.
If this field is `null` HTTP message body will inspected up to `bodyInspectionSizeLimitInBytes` and the rest will not be inspected by Protection Capabilities.
Allowed action types: * **RETURN_HTTP_RESPONSE** terminates further execution of modules and rules and returns defined HTTP response.
body_inspection_size_limit_in_bytes
integer
Maximum size of inspected HTTP message body in bytes. Actions to take if this limit is exceeded are defined in `bodyInspectionSizeLimitExceededActionName`.
Body inspection maximum size allowed is defined with per-tenancy limit: 8192 bytes.
rules
list / elements=dictionary
Ordered list of ProtectionRules. Rules are executed in order of appearance in this array. ProtectionRules in this array can only use protection Capabilities of REQUEST_PROTECTION_CAPABILITY type.
action_name
string / required
References action by name from actions defined in WebAppFirewallPolicy.
condition
string
An expression that determines whether or not the rule action should be executed.
condition_language
string
    Choices:
  • JMESPATH
The language used to parse condition from field `condition`. Available languages:
* **JMESPATH** an extended JMESPath language syntax.
is_body_inspection_enabled
boolean
    Choices:
  • no
  • yes
Enables/disables body inspection for this protection rule. Only Protection Rules in RequestProtection can have this option enabled. Response body inspection will be available at a later date.
name
string / required
Rule name. Must be unique within the module.
protection_capabilities
list / elements=dictionary / required
An ordered list that references OCI-managed protection capabilities. Referenced protection capabilities are not necessarily executed in order of appearance. Their execution order is decided at runtime for improved performance. The array cannot contain entries with the same pair of capability key and version more than once.
action_name
string
Override action to take if capability was triggered, defined in Protection Rule for this capability. Only actions of type CHECK are allowed.
collaborative_action_threshold
integer
The minimum sum of weights of associated collaborative protection capabilities that have triggered which must be reached in order for _this_ capability to trigger. This field is ignored for non-collaborative capabilities.
collaborative_weights
list / elements=dictionary
Explicit weight values to use for associated collaborative protection capabilities.
key
string / required
Unique key of collaborative capability for which weight will be overridden.
weight
integer / required
The value of weight to set.
exclusions
dictionary
args
list / elements=string
List of URL query parameter values from form-urlencoded XML, JSON, AMP, or POST payloads to exclude from inspecting. Example: If we have query parameter 'argumentName=argumentValue' and args=['argumentName'], both 'argumentName' and 'argumentValue' will not be inspected.
request_cookies
list / elements=string
List of HTTP request cookie values (by cookie name) to exclude from inspecting. Example: If we have cookie 'cookieName=cookieValue' and requestCookies=['cookieName'], both 'cookieName' and 'cookieValue' will not be inspected.
key
string / required
Unique key of referenced protection capability.
version
integer / required
Version of referenced protection capability.
protection_capability_settings
dictionary
allowed_http_methods
list / elements=string
List of allowed HTTP methods. Each value as a RFC7230 formated token string. Used in protection capability 911100: Restrict HTTP Request Methods.
max_http_request_header_length
integer
Maximum allowed length of headers in an HTTP request. Used in protection capability: 9200024: Limit length of request header size.
max_http_request_headers
integer
Maximum number of headers allowed in an HTTP request. Used in protection capability 9200014: Limit Number of Request Headers.
max_number_of_arguments
integer
Maximum number of arguments allowed. Used in protection capability 920380: Number of Arguments Limits.
max_single_argument_length
integer
Maximum allowed length of a single argument. Used in protection capability 920370: Limit argument value length.
max_total_argument_length
integer
Maximum allowed total length of all arguments. Used in protection capability 920390: Limit arguments total length.
type
string / required
    Choices:
  • ACCESS_CONTROL
  • PROTECTION
  • REQUEST_RATE_LIMITING
Type of WebAppFirewallPolicyRule.
request_rate_limiting
dictionary
This parameter is updatable.
rules
list / elements=dictionary
Ordered list of RequestRateLimitingRules. Rules are executed in order of appearance in this array.
action_name
string / required
References action by name from actions defined in WebAppFirewallPolicy.
condition
string
An expression that determines whether or not the rule action should be executed.
condition_language
string
    Choices:
  • JMESPATH
The language used to parse condition from field `condition`. Available languages:
* **JMESPATH** an extended JMESPath language syntax.
configurations
list / elements=dictionary / required
Rate Limiting Configurations. Each configuration counts requests towards its own `requestsLimit`.
action_duration_in_seconds
integer
Duration of block action application in seconds when `requestsLimit` is reached. Optional and can be 0 (no block duration).
period_in_seconds
integer / required
Evaluation period in seconds.
requests_limit
integer / required
Requests allowed per evaluation period.
name
string / required
Rule name. Must be unique within the module.
type
string / required
    Choices:
  • ACCESS_CONTROL
  • PROTECTION
  • REQUEST_RATE_LIMITING
Type of WebAppFirewallPolicyRule.
response_access_control
dictionary
This parameter is updatable.
rules
list / elements=dictionary
Ordered list of AccessControlRules. Rules are executed in order of appearance in this array.
action_name
string / required
References action by name from actions defined in WebAppFirewallPolicy.
condition
string
An expression that determines whether or not the rule action should be executed.
condition_language
string
    Choices:
  • JMESPATH
The language used to parse condition from field `condition`. Available languages:
* **JMESPATH** an extended JMESPath language syntax.
name
string / required
Rule name. Must be unique within the module.
type
string / required
    Choices:
  • ACCESS_CONTROL
  • PROTECTION
  • REQUEST_RATE_LIMITING
Type of WebAppFirewallPolicyRule.
response_protection
dictionary
This parameter is updatable.
rules
list / elements=dictionary
Ordered list of ProtectionRules. Rules are executed in order of appearance in this array. ProtectionRules in this array can only use protection capabilities of RESPONSE_PROTECTION_CAPABILITY type.
action_name
string / required
References action by name from actions defined in WebAppFirewallPolicy.
condition
string
An expression that determines whether or not the rule action should be executed.
condition_language
string
    Choices:
  • JMESPATH
The language used to parse condition from field `condition`. Available languages:
* **JMESPATH** an extended JMESPath language syntax.
is_body_inspection_enabled
boolean
    Choices:
  • no
  • yes
Enables/disables body inspection for this protection rule. Only Protection Rules in RequestProtection can have this option enabled. Response body inspection will be available at a later date.
name
string / required
Rule name. Must be unique within the module.
protection_capabilities
list / elements=dictionary / required
An ordered list that references OCI-managed protection capabilities. Referenced protection capabilities are not necessarily executed in order of appearance. Their execution order is decided at runtime for improved performance. The array cannot contain entries with the same pair of capability key and version more than once.
action_name
string
Override action to take if capability was triggered, defined in Protection Rule for this capability. Only actions of type CHECK are allowed.
collaborative_action_threshold
integer
The minimum sum of weights of associated collaborative protection capabilities that have triggered which must be reached in order for _this_ capability to trigger. This field is ignored for non-collaborative capabilities.
collaborative_weights
list / elements=dictionary
Explicit weight values to use for associated collaborative protection capabilities.
key
string / required
Unique key of collaborative capability for which weight will be overridden.
weight
integer / required
The value of weight to set.
exclusions
dictionary
args
list / elements=string
List of URL query parameter values from form-urlencoded XML, JSON, AMP, or POST payloads to exclude from inspecting. Example: If we have query parameter 'argumentName=argumentValue' and args=['argumentName'], both 'argumentName' and 'argumentValue' will not be inspected.
request_cookies
list / elements=string
List of HTTP request cookie values (by cookie name) to exclude from inspecting. Example: If we have cookie 'cookieName=cookieValue' and requestCookies=['cookieName'], both 'cookieName' and 'cookieValue' will not be inspected.
key
string / required
Unique key of referenced protection capability.
version
integer / required
Version of referenced protection capability.
protection_capability_settings
dictionary
allowed_http_methods
list / elements=string
List of allowed HTTP methods. Each value as a RFC7230 formated token string. Used in protection capability 911100: Restrict HTTP Request Methods.
max_http_request_header_length
integer
Maximum allowed length of headers in an HTTP request. Used in protection capability: 9200024: Limit length of request header size.
max_http_request_headers
integer
Maximum number of headers allowed in an HTTP request. Used in protection capability 9200014: Limit Number of Request Headers.
max_number_of_arguments
integer
Maximum number of arguments allowed. Used in protection capability 920380: Number of Arguments Limits.
max_single_argument_length
integer
Maximum allowed length of a single argument. Used in protection capability 920370: Limit argument value length.
max_total_argument_length
integer
Maximum allowed total length of all arguments. Used in protection capability 920390: Limit arguments total length.
type
string / required
    Choices:
  • ACCESS_CONTROL
  • PROTECTION
  • REQUEST_RATE_LIMITING
Type of WebAppFirewallPolicyRule.
state
string
    Choices:
  • present ←
  • absent
The state of the WebAppFirewallPolicy.
Use state=present to create or update a WebAppFirewallPolicy.
Use state=absent to delete a WebAppFirewallPolicy.
system_tags
dictionary
Usage of system tag keys. These predefined keys are scoped to namespaces. Example: `{"orcl-cloud": {"free-tier-retained": "true"}}`
This parameter is updatable.
tenancy
string
OCID of your tenancy. If not set, then the value of the OCI_TENANCY variable, if any, is used. This option is required if the tenancy OCID is not specified through a configuration file (See config_file_location). To get the tenancy OCID, please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm
wait
boolean
    Choices:
  • no
  • yes ←
Whether to wait for create or delete operation to complete.
wait_timeout
integer
Time, in seconds, to wait when wait=yes. Defaults to 1200 for most of the services but some services might have a longer wait timeout.
web_app_firewall_policy_id
string
The OCID of the WebAppFirewallPolicy.
Required for update using state=present when environment variable OCI_USE_NAME_AS_IDENTIFIER is not set.
Required for delete using state=absent when environment variable OCI_USE_NAME_AS_IDENTIFIER is not set.

aliases: id

Examples

- name: Create web_app_firewall_policy
  oci_waf_web_app_firewall_policy:
    # required
    compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx"

    # optional
    display_name: display_name_example
    actions:
    - # required
      code: 56
      type: RETURN_HTTP_RESPONSE
      name: name_example

      # optional
      headers:
      - # required
        name: name_example
        value: value_example
      body:
        # required
        type: STATIC_TEXT
        text: text_example
    request_access_control:
      # required
      default_action_name: default_action_name_example

      # optional
      rules:
      - # required
        type: ACCESS_CONTROL
        name: name_example
        action_name: action_name_example

        # optional
        condition_language: JMESPATH
        condition: condition_example
    request_rate_limiting:
      # optional
      rules:
      - # required
        type: ACCESS_CONTROL
        name: name_example
        action_name: action_name_example
        configurations:
        - # required
          period_in_seconds: 56
          requests_limit: 56

          # optional
          action_duration_in_seconds: 56

        # optional
        condition_language: JMESPATH
        condition: condition_example
    request_protection:
      # optional
      rules:
      - # required
        type: ACCESS_CONTROL
        name: name_example
        action_name: action_name_example
        protection_capabilities:
        - # required
          key: key_example
          version: 56

          # optional
          exclusions:
            # optional
            request_cookies: [ "request_cookies_example" ]
            args: [ "args_example" ]
          action_name: action_name_example
          collaborative_action_threshold: 56
          collaborative_weights:
          - # required
            key: key_example
            weight: 56

        # optional
        condition_language: JMESPATH
        condition: condition_example
        protection_capability_settings:
          # optional
          max_number_of_arguments: 56
          max_single_argument_length: 56
          max_total_argument_length: 56
          max_http_request_headers: 56
          max_http_request_header_length: 56
          allowed_http_methods: [ "allowed_http_methods_example" ]
        is_body_inspection_enabled: true
      body_inspection_size_limit_in_bytes: 56
      body_inspection_size_limit_exceeded_action_name: body_inspection_size_limit_exceeded_action_name_example
    response_access_control:
      # optional
      rules:
      - # required
        type: ACCESS_CONTROL
        name: name_example
        action_name: action_name_example

        # optional
        condition_language: JMESPATH
        condition: condition_example
    response_protection:
      # optional
      rules:
      - # required
        type: ACCESS_CONTROL
        name: name_example
        action_name: action_name_example
        protection_capabilities:
        - # required
          key: key_example
          version: 56

          # optional
          exclusions:
            # optional
            request_cookies: [ "request_cookies_example" ]
            args: [ "args_example" ]
          action_name: action_name_example
          collaborative_action_threshold: 56
          collaborative_weights:
          - # required
            key: key_example
            weight: 56

        # optional
        condition_language: JMESPATH
        condition: condition_example
        protection_capability_settings:
          # optional
          max_number_of_arguments: 56
          max_single_argument_length: 56
          max_total_argument_length: 56
          max_http_request_headers: 56
          max_http_request_header_length: 56
          allowed_http_methods: [ "allowed_http_methods_example" ]
        is_body_inspection_enabled: true
    freeform_tags: {'Department': 'Finance'}
    defined_tags: {'Operations': {'CostCenter': 'US'}}
    system_tags: null

- name: Update web_app_firewall_policy
  oci_waf_web_app_firewall_policy:
    # required
    web_app_firewall_policy_id: "ocid1.webappfirewallpolicy.oc1..xxxxxxEXAMPLExxxxxx"

    # optional
    display_name: display_name_example
    actions:
    - # required
      code: 56
      type: RETURN_HTTP_RESPONSE
      name: name_example

      # optional
      headers:
      - # required
        name: name_example
        value: value_example
      body:
        # required
        type: STATIC_TEXT
        text: text_example
    request_access_control:
      # required
      default_action_name: default_action_name_example

      # optional
      rules:
      - # required
        type: ACCESS_CONTROL
        name: name_example
        action_name: action_name_example

        # optional
        condition_language: JMESPATH
        condition: condition_example
    request_rate_limiting:
      # optional
      rules:
      - # required
        type: ACCESS_CONTROL
        name: name_example
        action_name: action_name_example
        configurations:
        - # required
          period_in_seconds: 56
          requests_limit: 56

          # optional
          action_duration_in_seconds: 56

        # optional
        condition_language: JMESPATH
        condition: condition_example
    request_protection:
      # optional
      rules:
      - # required
        type: ACCESS_CONTROL
        name: name_example
        action_name: action_name_example
        protection_capabilities:
        - # required
          key: key_example
          version: 56

          # optional
          exclusions:
            # optional
            request_cookies: [ "request_cookies_example" ]
            args: [ "args_example" ]
          action_name: action_name_example
          collaborative_action_threshold: 56
          collaborative_weights:
          - # required
            key: key_example
            weight: 56

        # optional
        condition_language: JMESPATH
        condition: condition_example
        protection_capability_settings:
          # optional
          max_number_of_arguments: 56
          max_single_argument_length: 56
          max_total_argument_length: 56
          max_http_request_headers: 56
          max_http_request_header_length: 56
          allowed_http_methods: [ "allowed_http_methods_example" ]
        is_body_inspection_enabled: true
      body_inspection_size_limit_in_bytes: 56
      body_inspection_size_limit_exceeded_action_name: body_inspection_size_limit_exceeded_action_name_example
    response_access_control:
      # optional
      rules:
      - # required
        type: ACCESS_CONTROL
        name: name_example
        action_name: action_name_example

        # optional
        condition_language: JMESPATH
        condition: condition_example
    response_protection:
      # optional
      rules:
      - # required
        type: ACCESS_CONTROL
        name: name_example
        action_name: action_name_example
        protection_capabilities:
        - # required
          key: key_example
          version: 56

          # optional
          exclusions:
            # optional
            request_cookies: [ "request_cookies_example" ]
            args: [ "args_example" ]
          action_name: action_name_example
          collaborative_action_threshold: 56
          collaborative_weights:
          - # required
            key: key_example
            weight: 56

        # optional
        condition_language: JMESPATH
        condition: condition_example
        protection_capability_settings:
          # optional
          max_number_of_arguments: 56
          max_single_argument_length: 56
          max_total_argument_length: 56
          max_http_request_headers: 56
          max_http_request_header_length: 56
          allowed_http_methods: [ "allowed_http_methods_example" ]
        is_body_inspection_enabled: true
    freeform_tags: {'Department': 'Finance'}
    defined_tags: {'Operations': {'CostCenter': 'US'}}
    system_tags: null

- name: Update web_app_firewall_policy using name (when environment variable OCI_USE_NAME_AS_IDENTIFIER is set)
  oci_waf_web_app_firewall_policy:
    # required
    compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx"
    display_name: display_name_example

    # optional
    actions:
    - # required
      code: 56
      type: RETURN_HTTP_RESPONSE
      name: name_example

      # optional
      headers:
      - # required
        name: name_example
        value: value_example
      body:
        # required
        type: STATIC_TEXT
        text: text_example
    request_access_control:
      # required
      default_action_name: default_action_name_example

      # optional
      rules:
      - # required
        type: ACCESS_CONTROL
        name: name_example
        action_name: action_name_example

        # optional
        condition_language: JMESPATH
        condition: condition_example
    request_rate_limiting:
      # optional
      rules:
      - # required
        type: ACCESS_CONTROL
        name: name_example
        action_name: action_name_example
        configurations:
        - # required
          period_in_seconds: 56
          requests_limit: 56

          # optional
          action_duration_in_seconds: 56

        # optional
        condition_language: JMESPATH
        condition: condition_example
    request_protection:
      # optional
      rules:
      - # required
        type: ACCESS_CONTROL
        name: name_example
        action_name: action_name_example
        protection_capabilities:
        - # required
          key: key_example
          version: 56

          # optional
          exclusions:
            # optional
            request_cookies: [ "request_cookies_example" ]
            args: [ "args_example" ]
          action_name: action_name_example
          collaborative_action_threshold: 56
          collaborative_weights:
          - # required
            key: key_example
            weight: 56

        # optional
        condition_language: JMESPATH
        condition: condition_example
        protection_capability_settings:
          # optional
          max_number_of_arguments: 56
          max_single_argument_length: 56
          max_total_argument_length: 56
          max_http_request_headers: 56
          max_http_request_header_length: 56
          allowed_http_methods: [ "allowed_http_methods_example" ]
        is_body_inspection_enabled: true
      body_inspection_size_limit_in_bytes: 56
      body_inspection_size_limit_exceeded_action_name: body_inspection_size_limit_exceeded_action_name_example
    response_access_control:
      # optional
      rules:
      - # required
        type: ACCESS_CONTROL
        name: name_example
        action_name: action_name_example

        # optional
        condition_language: JMESPATH
        condition: condition_example
    response_protection:
      # optional
      rules:
      - # required
        type: ACCESS_CONTROL
        name: name_example
        action_name: action_name_example
        protection_capabilities:
        - # required
          key: key_example
          version: 56

          # optional
          exclusions:
            # optional
            request_cookies: [ "request_cookies_example" ]
            args: [ "args_example" ]
          action_name: action_name_example
          collaborative_action_threshold: 56
          collaborative_weights:
          - # required
            key: key_example
            weight: 56

        # optional
        condition_language: JMESPATH
        condition: condition_example
        protection_capability_settings:
          # optional
          max_number_of_arguments: 56
          max_single_argument_length: 56
          max_total_argument_length: 56
          max_http_request_headers: 56
          max_http_request_header_length: 56
          allowed_http_methods: [ "allowed_http_methods_example" ]
        is_body_inspection_enabled: true
    freeform_tags: {'Department': 'Finance'}
    defined_tags: {'Operations': {'CostCenter': 'US'}}
    system_tags: null

- name: Delete web_app_firewall_policy
  oci_waf_web_app_firewall_policy:
    # required
    web_app_firewall_policy_id: "ocid1.webappfirewallpolicy.oc1..xxxxxxEXAMPLExxxxxx"
    state: absent

- name: Delete web_app_firewall_policy using name (when environment variable OCI_USE_NAME_AS_IDENTIFIER is set)
  oci_waf_web_app_firewall_policy:
    # required
    compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx"
    display_name: display_name_example
    state: absent

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
web_app_firewall_policy
complex
on success
Details of the WebAppFirewallPolicy resource acted upon by the current operation

Sample:
{'actions': [{'body': {'text': 'text_example', 'type': 'STATIC_TEXT'}, 'code': 56, 'headers': [{'name': 'name_example', 'value': 'value_example'}], 'name': 'name_example', 'type': 'CHECK'}], 'compartment_id': 'ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx', 'defined_tags': {'Operations': {'CostCenter': 'US'}}, 'display_name': 'display_name_example', 'freeform_tags': {'Department': 'Finance'}, 'id': 'ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx', 'lifecycle_details': 'lifecycle_details_example', 'lifecycle_state': 'CREATING', 'request_access_control': {'default_action_name': 'default_action_name_example', 'rules': [{'action_name': 'action_name_example', 'condition': 'condition_example', 'condition_language': 'JMESPATH', 'name': 'name_example', 'type': 'ACCESS_CONTROL'}]}, 'request_protection': {'body_inspection_size_limit_exceeded_action_name': 'body_inspection_size_limit_exceeded_action_name_example', 'body_inspection_size_limit_in_bytes': 56, 'rules': [{'action_name': 'action_name_example', 'condition': 'condition_example', 'condition_language': 'JMESPATH', 'is_body_inspection_enabled': True, 'name': 'name_example', 'protection_capabilities': [{'action_name': 'action_name_example', 'collaborative_action_threshold': 56, 'collaborative_weights': [{'key': 'key_example', 'weight': 56}], 'exclusions': {'args': [], 'request_cookies': []}, 'key': 'key_example', 'version': 56}], 'protection_capability_settings': {'allowed_http_methods': [], 'max_http_request_header_length': 56, 'max_http_request_headers': 56, 'max_number_of_arguments': 56, 'max_single_argument_length': 56, 'max_total_argument_length': 56}, 'type': 'ACCESS_CONTROL'}]}, 'request_rate_limiting': {'rules': [{'action_name': 'action_name_example', 'condition': 'condition_example', 'condition_language': 'JMESPATH', 'configurations': [{'action_duration_in_seconds': 56, 'period_in_seconds': 56, 'requests_limit': 56}], 'name': 'name_example', 'type': 'ACCESS_CONTROL'}]}, 'response_access_control': {'rules': [{'action_name': 'action_name_example', 'condition': 'condition_example', 'condition_language': 'JMESPATH', 'name': 'name_example', 'type': 'ACCESS_CONTROL'}]}, 'response_protection': {'rules': [{'action_name': 'action_name_example', 'condition': 'condition_example', 'condition_language': 'JMESPATH', 'is_body_inspection_enabled': True, 'name': 'name_example', 'protection_capabilities': [{'action_name': 'action_name_example', 'collaborative_action_threshold': 56, 'collaborative_weights': [{'key': 'key_example', 'weight': 56}], 'exclusions': {'args': [], 'request_cookies': []}, 'key': 'key_example', 'version': 56}], 'protection_capability_settings': {'allowed_http_methods': [], 'max_http_request_header_length': 56, 'max_http_request_headers': 56, 'max_number_of_arguments': 56, 'max_single_argument_length': 56, 'max_total_argument_length': 56}, 'type': 'ACCESS_CONTROL'}]}, 'system_tags': {}, 'time_created': '2013-10-20T19:20:30+01:00', 'time_updated': '2013-10-20T19:20:30+01:00'}
 
actions
complex
on success
Predefined actions for use in multiple different rules. Not all actions are supported in every module. Some actions terminate further execution of modules and rules in a module and some do not. Actions names must be unique within this array.

   
body
complex
on success

     
text
string
on success
Static response body text.

Sample:
text_example
     
type
string
on success
Type of HttpResponseBody.

Sample:
STATIC_TEXT
   
code
integer
on success
Response code.
The following response codes are valid values for this property:
* 2xx
200 OK 201 Created 202 Accepted 206 Partial Content
* 3xx
300 Multiple Choices 301 Moved Permanently 302 Found 303 See Other 307 Temporary Redirect
* 4xx
400 Bad Request 401 Unauthorized 403 Forbidden 404 Not Found 405 Method Not Allowed 408 Request Timeout 409 Conflict 411 Length Required 412 Precondition Failed 413 Payload Too Large 414 URI Too Long 415 Unsupported Media Type 416 Range Not Satisfiable 422 Unprocessable Entity 429 Too Many Requests 494 Request Header Too Large 495 Cert Error 496 No Cert 497 HTTP to HTTPS
* 5xx
500 Internal Server Error 501 Not Implemented 502 Bad Gateway 503 Service Unavailable 504 Gateway Timeout 507 Insufficient Storage
Example: `200`

Sample:
56
   
headers
complex
on success
Adds headers defined in this array for HTTP response.
Hop-by-hop headers are not allowed to be set:
* Connection * Keep-Alive * Proxy-Authenticate * Proxy-Authorization * TE * Trailer * Transfer-Encoding * Upgrade

     
name
string
on success
The name of the header field.

Sample:
name_example
     
value
string
on success
The value of the header field.

Sample:
value_example
   
name
string
on success
Action name. Can be used to reference the action.

Sample:
name_example
   
type
string
on success
* **CHECK** is a non-terminating action that does not stop the execution of rules in current module, just emits a log message documenting result of rule execution.
* **ALLOW** is a non-terminating action which upon matching rule skips all remaining rules in the current module.
* **RETURN_HTTP_RESPONSE** is a terminating action which is executed immediately, returns a defined HTTP response.

Sample:
CHECK
 
compartment_id
string
on success
The OCID of the compartment.

Sample:
ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx
 
defined_tags
dictionary
on success
Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{"foo-namespace": {"bar-key": "value"}}`

Sample:
{'Operations': {'CostCenter': 'US'}}
 
display_name
string
on success
WebAppFirewallPolicy display name, can be renamed.

Sample:
display_name_example
 
freeform_tags
dictionary
on success
Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{"bar-key": "value"}`

Sample:
{'Department': 'Finance'}
 
id
string
on success
The OCID of the WebAppFirewallPolicy.

Sample:
ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx
 
lifecycle_details
string
on success
A message describing the current state in more detail. For example, can be used to provide actionable information for a resource in FAILED state.

Sample:
lifecycle_details_example
 
lifecycle_state
string
on success
The current state of the WebAppFirewallPolicy.

Sample:
CREATING
 
request_access_control
complex
on success

   
default_action_name
string
on success
References an default Action to take if no AccessControlRule was matched. Allowed action types:
* **ALLOW** continues execution of other modules and their rules.
* **RETURN_HTTP_RESPONSE** terminates further execution of modules and rules and returns defined HTTP response.

Sample:
default_action_name_example
   
rules
complex
on success
Ordered list of AccessControlRules. Rules are executed in order of appearance in this array.

     
action_name
string
on success
References action by name from actions defined in WebAppFirewallPolicy.

Sample:
action_name_example
     
condition
string
on success
An expression that determines whether or not the rule action should be executed.

Sample:
condition_example
     
condition_language
string
on success
The language used to parse condition from field `condition`. Available languages:
* **JMESPATH** an extended JMESPath language syntax.

Sample:
JMESPATH
     
name
string
on success
Rule name. Must be unique within the module.

Sample:
name_example
     
type
string
on success
Type of WebAppFirewallPolicyRule.

Sample:
ACCESS_CONTROL
 
request_protection
complex
on success

   
body_inspection_size_limit_exceeded_action_name
string
on success
References action by name from actions defined in WebAppFirewallPolicy. Executed if HTTP message body size exceeds limit set in field `bodyInspectionSizeLimitInBytes`.
If this field is `null` HTTP message body will inspected up to `bodyInspectionSizeLimitInBytes` and the rest will not be inspected by Protection Capabilities.
Allowed action types: * **RETURN_HTTP_RESPONSE** terminates further execution of modules and rules and returns defined HTTP response.

Sample:
body_inspection_size_limit_exceeded_action_name_example
   
body_inspection_size_limit_in_bytes
integer
on success
Maximum size of inspected HTTP message body in bytes. Actions to take if this limit is exceeded are defined in `bodyInspectionSizeLimitExceededActionName`.
Body inspection maximum size allowed is defined with per-tenancy limit: 8192 bytes.

Sample:
56
   
rules
complex
on success
Ordered list of ProtectionRules. Rules are executed in order of appearance in this array. ProtectionRules in this array can only use protection Capabilities of REQUEST_PROTECTION_CAPABILITY type.

     
action_name
string
on success
References action by name from actions defined in WebAppFirewallPolicy.

Sample:
action_name_example
     
condition
string
on success
An expression that determines whether or not the rule action should be executed.

Sample:
condition_example
     
condition_language
string
on success
The language used to parse condition from field `condition`. Available languages:
* **JMESPATH** an extended JMESPath language syntax.

Sample:
JMESPATH
     
is_body_inspection_enabled
boolean
on success
Enables/disables body inspection for this protection rule. Only Protection Rules in RequestProtection can have this option enabled. Response body inspection will be available at a later date.

Sample:
True
     
name
string
on success
Rule name. Must be unique within the module.

Sample:
name_example
     
protection_capabilities
complex
on success
An ordered list that references OCI-managed protection capabilities. Referenced protection capabilities are not necessarily executed in order of appearance. Their execution order is decided at runtime for improved performance. The array cannot contain entries with the same pair of capability key and version more than once.

       
action_name
string
on success
Override action to take if capability was triggered, defined in Protection Rule for this capability. Only actions of type CHECK are allowed.

Sample:
action_name_example
       
collaborative_action_threshold
integer
on success
The minimum sum of weights of associated collaborative protection capabilities that have triggered which must be reached in order for _this_ capability to trigger. This field is ignored for non-collaborative capabilities.

Sample:
56
       
collaborative_weights
complex
on success
Explicit weight values to use for associated collaborative protection capabilities.

         
key
string
on success
Unique key of collaborative capability for which weight will be overridden.

Sample:
key_example
         
weight
integer
on success
The value of weight to set.

Sample:
56
       
exclusions
complex
on success

         
args
list / elements=string
on success
List of URL query parameter values from form-urlencoded XML, JSON, AMP, or POST payloads to exclude from inspecting. Example: If we have query parameter 'argumentName=argumentValue' and args=['argumentName'], both 'argumentName' and 'argumentValue' will not be inspected.

         
request_cookies
list / elements=string
on success
List of HTTP request cookie values (by cookie name) to exclude from inspecting. Example: If we have cookie 'cookieName=cookieValue' and requestCookies=['cookieName'], both 'cookieName' and 'cookieValue' will not be inspected.

       
key
string
on success
Unique key of referenced protection capability.

Sample:
key_example
       
version
integer
on success
Version of referenced protection capability.

Sample:
56
     
protection_capability_settings
complex
on success

       
allowed_http_methods
list / elements=string
on success
List of allowed HTTP methods. Each value as a RFC7230 formated token string. Used in protection capability 911100: Restrict HTTP Request Methods.

       
max_http_request_header_length
integer
on success
Maximum allowed length of headers in an HTTP request. Used in protection capability: 9200024: Limit length of request header size.

Sample:
56
       
max_http_request_headers
integer
on success
Maximum number of headers allowed in an HTTP request. Used in protection capability 9200014: Limit Number of Request Headers.

Sample:
56
       
max_number_of_arguments
integer
on success
Maximum number of arguments allowed. Used in protection capability 920380: Number of Arguments Limits.

Sample:
56
       
max_single_argument_length
integer
on success
Maximum allowed length of a single argument. Used in protection capability 920370: Limit argument value length.

Sample:
56
       
max_total_argument_length
integer
on success
Maximum allowed total length of all arguments. Used in protection capability 920390: Limit arguments total length.

Sample:
56
     
type
string
on success
Type of WebAppFirewallPolicyRule.

Sample:
ACCESS_CONTROL
 
request_rate_limiting
complex
on success

   
rules
complex
on success
Ordered list of RequestRateLimitingRules. Rules are executed in order of appearance in this array.

     
action_name
string
on success
References action by name from actions defined in WebAppFirewallPolicy.

Sample:
action_name_example
     
condition
string
on success
An expression that determines whether or not the rule action should be executed.

Sample:
condition_example
     
condition_language
string
on success
The language used to parse condition from field `condition`. Available languages:
* **JMESPATH** an extended JMESPath language syntax.

Sample:
JMESPATH
     
configurations
complex
on success
Rate Limiting Configurations. Each configuration counts requests towards its own `requestsLimit`.

       
action_duration_in_seconds
integer
on success
Duration of block action application in seconds when `requestsLimit` is reached. Optional and can be 0 (no block duration).

Sample:
56
       
period_in_seconds
integer
on success
Evaluation period in seconds.

Sample:
56
       
requests_limit
integer
on success
Requests allowed per evaluation period.

Sample:
56
     
name
string
on success
Rule name. Must be unique within the module.

Sample:
name_example
     
type
string
on success
Type of WebAppFirewallPolicyRule.

Sample:
ACCESS_CONTROL
 
response_access_control
complex
on success

   
rules
complex
on success
Ordered list of AccessControlRules. Rules are executed in order of appearance in this array.

     
action_name
string
on success
References action by name from actions defined in WebAppFirewallPolicy.

Sample:
action_name_example
     
condition
string
on success
An expression that determines whether or not the rule action should be executed.

Sample:
condition_example
     
condition_language
string
on success
The language used to parse condition from field `condition`. Available languages:
* **JMESPATH** an extended JMESPath language syntax.

Sample:
JMESPATH
     
name
string
on success
Rule name. Must be unique within the module.

Sample:
name_example
     
type
string
on success
Type of WebAppFirewallPolicyRule.

Sample:
ACCESS_CONTROL
 
response_protection
complex
on success

   
rules
complex
on success
Ordered list of ProtectionRules. Rules are executed in order of appearance in this array. ProtectionRules in this array can only use protection capabilities of RESPONSE_PROTECTION_CAPABILITY type.

     
action_name
string
on success
References action by name from actions defined in WebAppFirewallPolicy.

Sample:
action_name_example
     
condition
string
on success
An expression that determines whether or not the rule action should be executed.

Sample:
condition_example
     
condition_language
string
on success
The language used to parse condition from field `condition`. Available languages:
* **JMESPATH** an extended JMESPath language syntax.

Sample:
JMESPATH
     
is_body_inspection_enabled
boolean
on success
Enables/disables body inspection for this protection rule. Only Protection Rules in RequestProtection can have this option enabled. Response body inspection will be available at a later date.

Sample:
True
     
name
string
on success
Rule name. Must be unique within the module.

Sample:
name_example
     
protection_capabilities
complex
on success
An ordered list that references OCI-managed protection capabilities. Referenced protection capabilities are not necessarily executed in order of appearance. Their execution order is decided at runtime for improved performance. The array cannot contain entries with the same pair of capability key and version more than once.

       
action_name
string
on success
Override action to take if capability was triggered, defined in Protection Rule for this capability. Only actions of type CHECK are allowed.

Sample:
action_name_example
       
collaborative_action_threshold
integer
on success
The minimum sum of weights of associated collaborative protection capabilities that have triggered which must be reached in order for _this_ capability to trigger. This field is ignored for non-collaborative capabilities.

Sample:
56
       
collaborative_weights
complex
on success
Explicit weight values to use for associated collaborative protection capabilities.

         
key
string
on success
Unique key of collaborative capability for which weight will be overridden.

Sample:
key_example
         
weight
integer
on success
The value of weight to set.

Sample:
56
       
exclusions
complex
on success

         
args
list / elements=string
on success
List of URL query parameter values from form-urlencoded XML, JSON, AMP, or POST payloads to exclude from inspecting. Example: If we have query parameter 'argumentName=argumentValue' and args=['argumentName'], both 'argumentName' and 'argumentValue' will not be inspected.

         
request_cookies
list / elements=string
on success
List of HTTP request cookie values (by cookie name) to exclude from inspecting. Example: If we have cookie 'cookieName=cookieValue' and requestCookies=['cookieName'], both 'cookieName' and 'cookieValue' will not be inspected.

       
key
string
on success
Unique key of referenced protection capability.

Sample:
key_example
       
version
integer
on success
Version of referenced protection capability.

Sample:
56
     
protection_capability_settings
complex
on success

       
allowed_http_methods
list / elements=string
on success
List of allowed HTTP methods. Each value as a RFC7230 formated token string. Used in protection capability 911100: Restrict HTTP Request Methods.

       
max_http_request_header_length
integer
on success
Maximum allowed length of headers in an HTTP request. Used in protection capability: 9200024: Limit length of request header size.

Sample:
56
       
max_http_request_headers
integer
on success
Maximum number of headers allowed in an HTTP request. Used in protection capability 9200014: Limit Number of Request Headers.

Sample:
56
       
max_number_of_arguments
integer
on success
Maximum number of arguments allowed. Used in protection capability 920380: Number of Arguments Limits.

Sample:
56
       
max_single_argument_length
integer
on success
Maximum allowed length of a single argument. Used in protection capability 920370: Limit argument value length.

Sample:
56
       
max_total_argument_length
integer
on success
Maximum allowed total length of all arguments. Used in protection capability 920390: Limit arguments total length.

Sample:
56
     
type
string
on success
Type of WebAppFirewallPolicyRule.

Sample:
ACCESS_CONTROL
 
system_tags
dictionary
on success
Usage of system tag keys. These predefined keys are scoped to namespaces. Example: `{"orcl-cloud": {"free-tier-retained": "true"}}`

 
time_created
string
on success
The time the WebAppFirewallPolicy was created. An RFC3339 formatted datetime string.

Sample:
2013-10-20T19:20:30+01:00
 
time_updated
string
on success
The time the WebAppFirewallPolicy was updated. An RFC3339 formatted datetime string.

Sample:
2013-10-20T19:20:30+01:00


Authors

  • Oracle (@oracle)