We are excited to announce the Public Preview of the Temporal Cloud Terraform Provider. This provider allows developers to automate the management of their Temporal Cloud infrastructure using Terraform, an infrastructure as code tool created by HashiCorp.

What is Terraform?

Terraform is an open-source tool created by HashiCorp that allows developers to define their infrastructure using declarative configuration files. These files can be shared among team members, treated as code, and subjected to the same processes as application code, such as editing, reviewing, and versioning.

Why a Terraform Provider for Temporal Cloud?

The motivation for creating a Terraform Provider for Temporal Cloud came directly from your feedback. Many of you already use Terraform to manage your infrastructure and expressed a strong interest in managing Temporal Cloud resources similarly. With the introduction of the Terraform Provider, you can now automate the creation, management, and lifecycle of Temporal Cloud resources, Namespace and User to start. We plan to support more resources in future updates, expanding your management capabilities within the Temporal Cloud environment.

Use Cases

The Public Preview release supports Namespace and Users management through the Namespace, Search Attribute , and Users resources and a Namespace and Regions data source. These resources allow you to automate:

Getting Started

Temporal Cloud users can get started using Terraform provider right away. If you don’t have an account with Temporal, sign up here. You will also need to choose and setup the right Terraform infrastructure. HashiCorp provides excellent documentation to help you get started with Terraform. Finally, the Terraform provider uses Temporal Cloud API Keys for authentication. Make sure your Temporal Cloud account allows for API Key use and generates an API Key to use with the Terraform provider.

Once you have a Temporal Cloud account, a Terraform environment and API Key, you are ready to start managing Temporal Cloud resources with Terraform. Use case-specific documentation for the Temporal Cloud provider is located in Temporal’s documentation. We recommend starting with creating and deleting a new Namespace in your Temporal Cloud Account to get a feel for the Temporal Cloud Terraform provider.

Here’s a quick look at the Terraform configuration file, .tf file, included in the Create Namespace example. This example shows how easy it is to define the desired state of a Namespace, in this example a Namespace named “terraform”. Once the namespace is defined in the .tf file, Terraform will detect changes to the configuration values defined in this file and update Temporal Cloud with the Namespace changes automatically.

terraform {
  required_providers {
    temporalcloud = {
      source = "temporalio/temporalcloud"
      version = ">= 0.0.6"
    }
  }
}

provider "temporalcloud" {

}

resource "temporalcloud_namespace" "namespace" {
        name               = "terraform"
        regions            = ["aws-us-east-1"]
        accepted_client_ca = base64encode(file("ca.pem"))
        retention_days     = 14
}

The Temporal examples use Terraform’s CLI and the terraform apply command to execute configuration changes. Terraform provides success messages, like the following, when a Namespace is successfully created for the first time with Terraform.

temporalcloud_namespace.namespace: Creation complete after 2m17s [id=<yournamespace>]

See the Temporal’s Terraform provider documentation for detailed, step-by-step guides for managing Temporal Cloud Namespaces, CA certificates and Users with Terraform.

Using an Infrastructure as Code tool like Terraform assumes all changes to resources occurs through Terraform. This means, you should import existing Temporal Cloud Namespace and Users into Terraform using Terraform’s import capabilities to manage these resources with Terraform. The Temporal Cloud Terraform provider supports import for Namespaces and Users.

Looking Ahead

The Terraform Provider for Temporal Cloud is just the beginning of our journey toward fully automated Temporal Cloud resource management. Your feedback during this Public Preview is crucial as we plan to support more resources and enhance the provider’s capabilities.

We look forward to seeing how you use the Terraform Provider to automate and streamline your Temporal Cloud operations. Share your experiences, suggestions, and issues on our GitHub repository or through our community channels. Let’s shape the future of cloud resource management together.