Rules builder

akamai_property_rules_builder

ūüöß

Beta

This is a beta version of the rules builder data source. Use of this version is as is and as available while still in testing and development.

Build your property rules, includes, behaviors, and criteria into a single set of rules or a rules file. A list of all behaviors and criteria can be found in the reference section.

// Your default rule information
data "akamai_property_rules_builder" "my_default_rule" {
  rules_v2023_01_05 {
    name      = "default"
    is_secure = false
    comments  = <<-EOT
      The behaviors in the default rule apply to all requests for the property hostnames unless another rule overrides these settings.
    EOT
    behavior {
      origin {
        origin_type                   = "CUSTOMER"
        hostname                      = "httpbin.org"
        forward_host_header           = "ORIGIN_HOSTNAME"
        cache_key_hostname            = "REQUEST_HOST_HEADER"
        compress                      = true
        enable_true_client_ip         = false
        http_port                     = 80
      }
    }
    behavior {
      cp_code {
        value {
          id   = 12345
          name = "main site"
        }
      }
    }
    children = [
      data.akamai_property_rules_builder.compress_text_content.json
    ]
  }
}

// Your child rule information
data "akamai_property_rules_builder" "compress_text_content" {
  rules_v2023_01_05 {
    name = "Compress Text Content"
    behavior {
      gzipResponse {
          behavior = "ALWAYS"
      }
    }
    criterion {
      contentType {
        matchOperator      = "IS_ONE_OF"
        matchWildcard      = true
        matchCaseSensitive = false
        values             = ["text/html*", "text/css*", "application/x-javascript*"]
      }
    }
  }
}

output "my_default_rule" {
  value = data.akamai_property_rules_builder.my_default_rule
} 
Changes to Outputs:
  + my_default_rule = jsonencode(
        {
          + rules = {
              + behaviors = [
                  + {
                      + name    = "origin"
                      + options = {
                          + cacheKeyHostname   = "REQUEST_HOST_HEADER"
                          + compress           = true
                          + enableTrueClientIp = false
                          + forwardHostHeader  = "ORIGIN_HOSTNAME"
                          + hostname           = "example.org"
                          + httpPort           = 80
                          + originType         = "CUSTOMER"
                        }
                    },
                  + {
                      + name    = "cpCode"
                      + options = {
                          + value = {
                              + id   = 12345
                              + name = "main site"
                            }
                        }
                    },
                ]
              + children  = [
                  + {
                      + behaviors = [
                          + {
                              + name    = "gzipResponse"
                              + options = {
                                  + behavior = "ALWAYS"
                                }
                            },
                        ]
                      + criteria  = [
                          + {
                              + name    = "contentType"
                              + options = {
                                  + matchCaseSensitive = false
                                  + matchOperator      = "IS_ONE_OF"
                                  + matchWildcard      = true
                                  + values             = [
                                      + "text/html*",
                                      + "text/css*",
                                      + "application/x-javascript*",
                                    ]
                                }
                            },
                        ]
                      + name      = "Compress Text Content"
                      + options   = {}
                    },
                ]
              + comments  = <<-EOT
                    The behaviors in the default rule apply to all requests for the property hostname(s) unless another rule overrides theses settings.
                EOT
              + name      = "default"
              + options   = {}
            }
        }
    )
// Uses Terraform resource local_file
resource "local_file" "rules" {
    content  = data.akamai_property_rules_builder.my_default_rule.json
    filename = "./property-snippets/main.json"
} 
// local
rules = data.akamai_property_rules_builder.my_default_rule

// reference file directly
rules = file("${path.root}/property-snippets/main.json")

Arguments

Send your rule's name, rule format version, and any of the optional arguments that build out your rule's business case.

ArgumentRequiredDescription
name‚úĒÔłŹThe name of your rule. If you're sending the entire tree, this value is default.
rule_format‚úĒÔłŹThe versioned schema that represents a valid rule tree.
is_secureWhether the default rule is secure.

Not applicable for child rules.
behaviorA behavior for a rule.
variableA list of variables for a rule.
  • name. The name of a variable.
  • value. The value for a variable.
  • description. The description for a variable.
  • hidden. Whether a variable should be hidden.
  • sensitive. Whether a variable contains sensitive information.
criterionA match target for a rule.

Not applicable for the default rule.
criteria_must_satisfyWhether all criteria need to match or any.

Not applicable for the default rule.
advanced_overrideXML metadata of the rule.

Not applicable for child rules.
custom_overrideA rule's XML metadata.
  • name. The name of a custom override.
  • override_id. The ID of a custom override.
  • children. A list of child rules for a particular rule in JSON format.


Not applicable for child rules.
commentsAny comments for a rule.
uuidThe rule's UUID.
template_uuidThe rule template's UUID.
criteria_lockedWhether changes to criterion objects are prohibited.

Not applicable for the default rule.
template_linkThe rule's template link.

Attributes

For any output method you chose, returned to you is your full set of rules in the rule format you passed in the request.