---
updatedAt: 2026-03-01T18:01:55.000Z
agentTools:
  siteIndex: https://techdocs.akamai.com/llms.txt
  projectIndex: https://techdocs.akamai.com/terraform/llms.txt
---

# 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.

```json Declaration: Basic
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"
  }
}
```
```json Declaration: With dependencies
// 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.

[block:parameters]
{
  "data": {
    "h-0": "Argument",
    "h-1": "Required",
    "h-2": "Description",
    "0-0": "`name`",
    "0-1": "✔",
    "0-2": "A 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 ^ # %.",
    "1-0": "`contract_id`",
    "1-1": "✔",
    "1-2": "Your contract's ID.",
    "2-0": "`group_id`",
    "2-1": "✔",
    "2-2": "Your group's ID.",
    "3-0": "`product_id`",
    "3-1": "✔",
    "3-2": "A product ID including the `prd_` prefix. See [Common identifiers](https://techdocs.akamai.com/terraform/docs/common-identifiers#product-ids)  for a list of product IDs.",
    "4-0": "`timeouts`",
    "4-1": "",
    "4-2": "An `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: <ul><li><code>1h3m5s</code></li><li><code>2h5m</code></li><li><code>3m</code></li></ul>"
  },
  "cols": 3,
  "rows": 5,
  "align": [
    "left",
    "center",
    "left"
  ]
}
[/block]

## 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`.

# Sibling pages

* [Activation](https://techdocs.akamai.com/terraform/docs/pm-rc-activation.md)
* [Domains](https://techdocs.akamai.com/terraform/docs/pm-rc-domains.md)
* [Domain validation](https://techdocs.akamai.com/terraform/docs/pm-rc-domain-validation.md)
* [Edge hostname](https://techdocs.akamai.com/terraform/docs/pm-rc-edge-hostname.md)
* [Hostname bucket](https://techdocs.akamai.com/terraform/docs/pm-rc-hostname-bucket.md)
* [Include](https://techdocs.akamai.com/terraform/docs/pm-rc-include.md)
* [Include activation](https://techdocs.akamai.com/terraform/docs/pm-rc-include-activation.md)
* [Late domain validation](https://techdocs.akamai.com/terraform/docs/pm-rc-domain-late-validation.md)
* [Property](https://techdocs.akamai.com/terraform/docs/pm-rc-property.md)