GuideReference
TrainingSupportCommunity

Audience segmentation match rule

akamai_cloudlets_audience_segmentation_match_rule

Build a match rule JSON object for the audience segmentation cloudlet.

data "akamai_cloudlets_audience_segmentation_match_rule" "my_as_match_rule" {
  match_rules {
    name = "my_as_rule"
    matches {
      match_type     = "header"
      match_operator = "contains"
      object_match_value {
        type = "object"
        name = "cookie"
        options {
          value = ["abcd"]
        }
      }
    }
    forward_settings {
      path_and_qs               = "/test"
      use_incoming_query_string = true
      origin_id                 = "myOrigin"
    }
  }
}

output "my_as_match_rule" {
  value = data.akamai_cloudlets_audience_segmentation_match_rule.my_as_match_rule
}
Changes to Outputs:
  + my_as_match_rule       = {
      + id          = "12ab3cde4f5g678h901234567i890123j456k789"
      + json        = jsonencode(
            [
              + {
                  + forwardSettings = {
                      + originId               = "myOrigin"
                      + pathAndQS              = "/test"
                      + useIncomingQueryString = true
                    }
                  + matches         = [
                      + {
                          + caseSensitive    = false
                          + matchOperator    = "contains"
                          + matchType        = "header"
                          + negate           = false
                          + objectMatchValue = {
                              + name              = "cookie"
                              + nameCaseSensitive = false
                              + nameHasWildcard   = false
                              + options           = {
                                  + value = [
                                      + "abcd",
                                    ]
                                }
                              + type              = "object"
                            }
                        },
                    ]
                  + name            = "my_as_rule"
                  + type            = "asMatchRule"
                },
            ]
        )
      + match_rules = [
          + {
              + disabled         = false
              + end              = 0
              + forward_settings = [
                  + {
                      + origin_id                 = "myOrigin"
                      + path_and_qs               = "/test"
                      + use_incoming_query_string = true
                    },
                ]
              + match_url        = ""
              + matches          = [
                  + {
                      + case_sensitive     = false
                      + check_ips          = ""
                      + match_operator     = "contains"
                      + match_type         = "header"
                      + match_value        = ""
                      + negate             = false
                      + object_match_value = [
                          + {
                              + name                = "cookie"
                              + name_case_sensitive = false
                              + name_has_wildcard   = false
                              + options             = [
                                  + {
                                      + value                = [
                                          + "abcd",
                                        ]
                                      + value_case_sensitive = false
                                      + value_escaped        = false
                                      + value_has_wildcard   = false
                                    },
                                ]
                              + type                = "object"
                              + value               = []
                            },
                        ]
                    },
                ]
              + name             = "my_as_rule"
              + start            = 0
              + type             = "asMatchRule"
            },
        ]
    }

Arguments

Pass a match_rules list with the options that best fit your business case. While the match definitions arguments are optional, expected, at a minimum, is the forward_settings argument.

Use the information in the match options table to build out your rule's matches criteria.

Argument Required Description
forward_settings ‚úĒ The data used to construct a new request URL if all match conditions are met. When all conditions are met, the edge server returns an HTTP response from the rewritten URL.
  • origin_id. A user created ID that represents a data center for an application load balancer implementation. Alphanumeric characters and underscores only, and the first and last characters must be alphanumeric.
  • use_incoming_query_string. Whether the cloudlet includes the query string from the request in the rewritten or forwarded URL.
  • path_and_qs. Defines the path, resource, or query string added to the rewritten URL.
name A human-readable name for your rule.
start The start time for the match. Value is UTC through seconds.
end The end time for the match. Value is UTC through seconds.
match_url The URL that the cloudlet uses to match with the incoming request.
disabled Whether to disable a rule so it is not evaluated against incoming requests.
matches The match object definitions list.

Match options

The options listed are nested within the matches argument.

All match options are optional.

Argument Description
match_type The type of match used. Value is one of:
  • header
  • hostname
  • path
  • extension
  • query
  • cookie
  • deviceCharacteristics
  • clientip
  • continent
  • countrycode
  • regioncode
  • protocol
  • method
  • proxy
match_value A value that reflects your match type, for example, if you set your match type to countrycode, the value would reflect the match country.
match_operator Compares a string expression with a pattern. Value is one of:
  • contains
  • exists
  • equals
case_sensitive Whether the match is case sensitive.
negate Whether to negate the match.
check_ips For clientip, continent, countrycode, proxy, and regioncode match types, the part of the request to use as the IP address. Value options:
  • CONNECTING_IP
  • XFF_HEADERS
  • You can use both separated by a space. When both values are included, the connecting IP address is evaluated first.
object_match_value Use when a rule includes more complex match criteria, like multiple value attributes. Value options:
  • name. One of cookie, header, parameter, or query.
  • type. Required. The type of list, either object or simple.
  • name_case_sensitive. Whether the evaluation of the name argument is case sensitive.
  • name_has_wildcard. Whether the name argument includes wildcards.
  • options. If you set the type argument to object, use this to list the values on which to match.
    • value. The values in the incoming request on which to match.
    • value_has_wildcard. Whether the value argument includes wildcards.
    • value_case_sensitive. Whether the evaluation of the value argument is case sensitive.
    • value_escaped. Whether the compared value argument can be an escaped form.
  • value. If you set the type argument to simple, provide the values in the incoming request on which to match.

Attributes

Returned is a jsonencoded list of the match rules defined in your query. Set the output type to capture the result based on your need as you use the return in the policy resource.