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.

Before you begin

How it works

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

  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.

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.

    ūüďė

    Exporting includes using the --schema flag requires use of the v2023-01-05 rule format. 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 {property-name}
    

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

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, activate your property.

Activate your property

Activate your property on staging first, promoting your configuration to production when you're satisfied with your test results.

To activate your property, use 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."
}