Skip to main content

Setting up a Project

Add the Katapult Provider to a new Terraform Project

We can begin setting up a new Terraform project by creating a new directory and adding a main.tf file to it. This file will contain the configuration for our project.

mkdir my-terraform-project
cd my-terraform-project
touch main.tf

Next, we need to add the Katapult provider to our project. We can do this by adding the following code to our main.tf file:

terraform {
required_providers {
katapult = {
source = "krystal/katapult"
version = "~> 0.0"
}
}
}

provider "katapult" {
api_key = var.api_key
organization = var.organization
data_center = var.data_center
}

Manage Variables

You can pass these variables to Terraform in a number of ways, such as using environment variables, a .tfvars file, or by passing them directly to the terraform command.

What Variables do I need?

You will need the following variables to use the Katapult provider:

  • api_key - Your Katapult API key
  • organization - Your Katapult organization Subdomain.
  • data_center - The Permalink of the data center you want to use.

These are the available data center permalinks:

  • uk-lon-01 - London, United Kingdom
  • nl-ams-01 - Amsterdam, Netherlands
  • us-nyc-01 - New York City, United States of America
  • us-azp-01 - Phoenix, United States of America

Pass Variables to Terraform

Using a .tfvars file.

Create a file, for example variables.tfvars, and define your variables in it:

api_key = "your-api-key"
organization = "your-organization"
data_center = "your-data-center"

Then, you can pass the variables to Terraform using the -var-file flag:

terraform apply -var-file=variables.tfvars

Initialize the Project

Now that we have our provider and variables set up, we can initialize our project by running the following command:

terraform init

This command will download the Katapult provider and any other dependencies required for our project.