GuideReference
TrainingSupportCommunity
Guide

CP code

akamai_cp_code

Create or reuse Content Provider (CP) codes. CP codes track web traffic handled by Akamai servers. Akamai gives you a CP code when you purchase a product. You need this code when you activate associated properties.

You can create additional CP codes to support more detailed billing and reporting functions.

By default, the Akamai Provider uses your existing CP code instead of creating a new one.

resource "akamai_cp_code" "my_cp_code" {
  name        = "My CP Code"
  contract_id = "C-0N7RAC7"
  group_id    = "12345"
  product_id  = "prd_Object_Delivery"
  timeouts {
    update = "1h"
  }
}
// The example includes other data sources as dependencies.
locals {
  group_name  = "My group name"
  cpcode_name = "My CP code"
}

data "akamai_group" "my_group" {
  name        = local.group_name
  contract_id = data.akamai_contract.my_contract.id
}

data "akamai_contract" "my_contract" {
  group_name = local.group_name
}

resource "akamai_cp_code" "my_cp_code" {
  name        = local.cpcode_name
  group_id    = data.akamai_group.my_group.id
  contract_id = data.akamai_contract.my_contract.id
  product_id  = "prd_Object_Delivery"
}

Arguments

Pass a CP code name along with your contract, group, and product IDs to create a new CP code.

ArgumentRequiredDescription
nameA human-readable name you give to identify your CP code. If you're creating a new CP code, the name can't include commas, underscores, quotes, or any of these special characters, including ^ # %.
contract_idYour contract's ID.
group_idYour group's ID.
product_idA product ID including the prd_ prefix. See Common identifiers for a list of product IDs.
timeoutsAn update argument to override the HashiCorp processing timeout of 20 minutes. Value is a string containing a number and its time reference, h, m, s. You can pass one, two, or all values. For example:
  • 1h3m5s
  • 2h5m
  • 3m

Attributes

There is no default standard output. Upon creation, the last line of the process log contains an id of the CP code.

Adding an output block returns the CP code details you provided on create along with its computed id.