GuideReference
TrainingSupportCommunity
Guide

Provision properties

Create and manage the rule trees, behaviors, and criteria that process how your site's requests, responses, and other objects are served across our platform with property configurations.

What you'll do

Configure a property with defined rules, behaviors, and match criteria that trigger action to control how edge servers respond to various kinds of requests to your site and its content.

👍

Tip

The Terraform VS Code Extension includes a dynamic edit feature that pulls in Property documentation and provides a list of available behaviors and match criteria.

1. Create or import a property

Create a new property or import an existing one to get a rule format and rule tree to spec out your rules.

Create new

Pass the minimum arguments required in the declaration to create a property with a default set of rules. The defaults provide basic services and protections that you can either activate or edit.

  1. Add a unique name and your product, contract, and group IDs to the akamai_property resource with a rule format value no earlier than v2023-01-05.

    resource "akamai_property" "new-property" {
        name        = "my-new-property"
        product_id  = "prd_product"
        contract_id = "ctr_C-0N7RAC7"
        group_id    = "grp_12345"
        rule_format = "v2023-01-05"
    }
    
  2. Run terraform plan to check your syntax, and if it's correct, run terraform apply to create a property with the default rule format.

You can use this default property on the network as is, refine the default rules to fit your needs, or replace the defaults with an existing set of rules.

To use the defaults on a network:

  • Add a CP code and an origin hostname to the behaviors of your default rule.
  • Add an edge hostname in an update to your property.
  • Activate your property.

Import a property

  1. Get a list of all of your properties to find the name of the property with the rule tree you want.

    data "akamai_properties" "get-my-properties" {
      contract_id = "ctr_C-0N7RAC7"
      group_id    = "grp_12345"
    }
    
    output "my-property-list" {
      value = data.akamai_properties.get-my-properties
    }
    
  2. Use the name of the property you want as the value for the export-property argument of the akamai CLI command.
    By default, Terraform imports your latest property version whether it is active or not. Pass a version number with the --version command flag to target a specific version.

    📘

    Exporting includes using the --schema flag requires use of rule format no earlier than v2023-01-05. If you've got an earlier date, update your rule format.

    akamai terraform --edgerc {location-of-your-edgerc-file} --section {section-of-edgerc-to-use} export-property --version {property-version-number} {property-name}
    

    The response is your entire property configuration with its rules in JSON format.

  3. Run the included import script to populate your Terraform state. This prevents Terraform from attempting to recreate your assets.

Make your changes and activate the property to apply your changes to a network.

2. Set up your rules

Property configuration rules and includes use behaviors to determine the action taken when specific conditions are met. The options you choose define both the rule's behavior and the criteria that trigger the behavior's action.

Each rule format version contains the schema for a set of rules, behaviors, options, and criteria.

For more on how to work with the schema, see Property behaviors.

Update rule format

To update your rule format, pass the rule format version you need in the property resource.

resource "akamai_property" "update-rule-format" {
    name        = "my-property"
    product_id  = "prd_product"
    contract_id = "ctr_C-0N7RAC7"
    group_id    = "grp_12345"
    rule_format = "v2023-01-05"
}

Update rules

You can make edits to the full JSON file you pulled down or if you only want to update one or two rules, you can pass just those snippets using rule templates.

Whether you made edits or want to reuse an exported rule tree, you need to associate them with a property so you can activate them on a network.

If you made your updates directly in your rules JSON file, pass the path to the file in the property resource.

resource "akamai_property" "add-my-rules" {
    name        = "my-property"
    product_id  = "prd_product"
    contract_id = "ctr_C-0N7RAC7"
    group_id    = "grp_12345"
    rule_format = "v2023-01-05"
    rules       = file("${path.root}/property-snippets/main.json")
}

If you updated your files using rule templates, pass an absolute or relative path to the files in the rules template data source and then point to the data source in the property resource.

data "akamai_property_rules_template" "template-update" {
  template_file = abspath("${path.root}/property-snippets/main.json")
}

resource "akamai_property" "example" {
  contract_id = "ctr_C-0N7RAC7"
  group_id    = "grp_12345"
  rule_format = "v2023-01-05"
  rules       = data.akamai_property_rules_template.template-update.json
}

To apply your rules on a network, add hostnames and activate your property.

3. Create or import a hostname

Akamai supports three types of edge hostnames. Each type supports a different level of security.

Edge hostname typeDomain suffixExample
Standard TLSedgesuite.netwww.example.com.edgesuite.net
Enhanced TLSedgekey.netwww.example.com.edgekey.net
Shared Certakamaized.netwww.example.com.akamaized.net

Create an edge hostname

To create an edge hostname, pass a product ID, add a domain suffix to your origin hostname, and set the IP behavior to IPV4 or IPV6_IPV4_DUALSTACK in the akamai_edge_hostname resource.

resource "akamai_edge_hostname" "my_edge_hostname" {
   product_id    = "prd_Obj_Delivery"
   contract_id = "C-0N7RAC7"
   group_id    = "12345"
   edge_hostname = "www.example.com.edgekey.net"
   ip_behavior   = "IPV6_IPV4_DUALSTACK"
   status_update_email = ["jsmith@email.com"]
 }

Add the hostname to your property resource and then run apply to update your property.

Import an edge hostname

To add an edge hostname to your state, use the terraform import command with your hostname's name and your contract and group IDs.

  1. Get a list of your hostname. Use the edge_hostname_id downstream.

    data "akamai_property_hostnames" "my_property_hostnames" {
       group_id    = "12345"
       contract_id = "C-0N7RAC7"
       property_id = "12345"
       version     = 3
    }
    
    + my_property_hostnames = {
         + contract_id = "C-0N7RAC7"
         + group_id    = "12345"
         + hostnames   = [
             + {
                 + cert_provisioning_type = "DEFAULT"
                 + cert_status            = [
                     + {
                         + hostname          = "_acme-challenge.my-property-hostnames.com"
                         + production_status = "ACTIVE"
                         + staging_status    = "ACTIVE"
                         + target            = "ac.123456a1234abc1abcdefg12345a1234.my-property-hostnames.com.validate-akdv.net"
                       },
                   ]
                 + cname_from             = "my-property-hostnames.com"
                 + cname_to               = "my-property-hostnames.com.edgesuite.net"
                 + cname_type             = "EDGE_HOSTNAME"
                 + edge_hostname_id       = "ehn_1234567"
               },
           ]
         + id          = "prp_1234567"
         + property_id = "prp_123456"
         + version     = 3
       }
    
  2. Use a variable to the resource along with the edge_hostname_id and your contract and group IDs with the prefix in the terraform import command to add the hostname to your state.

    $ terraform import akamai_edge_hostname.my_hostname_import,ctr_C-0N7RAC7,grp_12345
    

4. Activate your property

Activate your property to apply it's settings to your site and its traffic. Activate on staging first, promoting your configuration to production when you're satisfied with your test results.

To activate your property, pass your property ID, a network designation, and a note in the property activation resource.

// Staging network example. Change network value to production for production environment.
resource "akamai_property_activation" "my_staging_activation" {
     property_id = "prp_12345"
     contact     = ["jsmith@example.com"]
     version     = "latest"
     network     = "staging"
     note        = "Activating my property on staging."
}