Manage Akamai-as-Code with Terraform

Manage Akamai-as-Code with Terraform

July 7, 2020 · by Mike Elissen ·

With the Akamai Terraform Provider, you are able to manage your Akamai-as-code. The Akamai Terraform Provider offers you the ability to execute key use-cases to manage your Akamai solutions. The Akamai Terraform Provider is officially approved by HashiCorp, who maintains Terraform. 

You can find the full documentation including code examples and Getting Started tutorials on the Terraform Documentation website:

What is supported today in the Akamai Terraform Provider?

Information as of July 2020

  1. Manage your DNS zones and recordsets.

  2. Manage your load balancing configurations.

  3. Manage your delivery configurations.

  4. Manage your Edge Hostnames and CP Codes.

  5. Import existing DNS zones and Akamai configurations with the use of the Akamai Terraform CLI package.

Setting Up the Akamai Terraform Provider


In order to get started with the Akamai Terraform Provider, the following is required:

  1. Either install the Akamai Development Environment or install Terraform.

    • Install the Akamai Development Environment: Both Terraform and the Akamai Terraform CLI package come pre-installed in the Akamai Development Environment. Get more details in our installation Instructions.

    • Install Terraform: Installing Terraform as a stand-alone installation. You can get more details in our instructions.

  2. Create an Akamai API Client with the right permissions and valid credentials to authenticate your Akamai Terraform files.

  3. Either import existing configurations with the Akamai Terraform CLI or start from scratch with code examples.

  4. Run the terraform init command to load the Akamai Terraform Provider.

  5. Run the terraform plan or terraform apply command to run your Terraform configuration.

Authenticate Terraform

Authentication of Terraform configurations relies on the Akamai EdgeGrid. The Akamai Terraform Provider code acts as a wrapper for our APIs and re-uses the same authentication mechanism.  

Note: We recommend storing your API credentials in a local .edgerc file.

When creating an Akamai API Client for use with the Akamai Terraform Provider, you’ll need to ensure that your API Client has read-write access to the following APIs depending on your use-case, including: Property Manager API (PAPI)

  • Traffic Management API

Note: Without these permissions, your Terraform configurations won’t execute.

Import the Terraform CLI Package

The Terraform CLI package is also included in the Akamai Development Environment and can help you get started with the Akamai Terraform Provider faster. 

This CLI package allows you to specify an existing Akamai delivery configuration or DNS zone with a recordset and export this into your proper Akamai Terraform configuration.

You can find detailed instructions in our Terraform CLI GitHub repository.

Create Your Terraform Configuration From Code Examples

You can start creating your Akamai Terraform files using our code examples from the Akamai Terraform Provider GitHub repository.

Run your Terraform file

After saving your configuration and navigate to the right directory in your command line, simply run the terraform init command to load the Akamai Terraform Provider, run the terraform plan to verify your changes and run the terraform apply command to execute your Terraform configuration.

Terraform Use Case

Manage DNS-as-code with Terraform

The Akamai Terraform Provider allows you to manage your DNS and load balancing configurations if you have access to Akamai Global Traffic Management or Akamai Edge DNS (formerly known as Akamai Fast DNS). You are able to fully manage your DNS zones, DNS records as well as any load balancing configurations you have configured in GTM.

The Akamai Terraform CLI package allows you to easily migrate any existing Edge DNS zone with a recordset and/or GTM configuration into a Terraform configuration. You can also manually create your Akamai Terraform configuration with either DNS or GTM resources.

You will have the ability to fully manage your DNS and load balancing through Terraform without the need for making manual changes inside the Akamai Control Center.

The steps required to get started with this use-case are as follows:

  1. Install Terraform, either manually or through the Akamai Development Environment.

  2. Create an Akamai API Client with the DNS API and Traffic Management API (you’ll need read-write permissions).

  3. Import an existing DNS or GTM configuration with the Akamai Terraform CLI package or create a configuration from scratch.

  4. Run terraform init to load the Akamai Terraform Provider.

  5. Run terraform apply to send your DNS zones, records, and load balancing settings to Akamai.

  6. Continue managing your Akamai-as-code by making manual changes to your Terraform configurations.

Alternatively, you can also store your Terraform configurations in a code repository tool such as GitHub.

This use-case is fully showcased in the webinar recording, attached below.

Watch the Full Recording

You can watch the full Webinar recording from July 2020 below to learn about Terraform and see our demos.

You Might Also Like

Video Tutorial

The tutorial above is fully explained on 15-minute YouTube playlist.