Temporal Cloud Terraform provider
The Terraform Temporal provider is a plugin that allows Terraform to manage resources on Temporal Cloud. Terraform is a tool used to codify and provision infrastructure as code (IaC). With this provider, you can use Terraform to automate the management of Temporal Cloud Namespaces, resources for Temporal Cloud users, and more.
The Temporal Cloud Terraform provider is available in the Terraform Registry, where you can find detailed documentation on the supported resources and data sources.
The GitHub repository for the Terraform provider is terraform-provider-temporalcloud, where you can find the source code, contribution guidelines, and additional information.
Temporal supports the Cloud Namespace resource management, a user resource for managing Temporal Cloud users, and data sources for retrieving information about existing Namespaces and users, with the Temporal Cloud Terraform provider.
Prerequisites
You must have access to the following to use the Temporal Cloud Terraform provider:
- Terraform account
- Terraform CLI
- API Key: an API Key is required to use the Terraform provider.
- Temporal tcld: This is an optional tool used to log in to your Temporal Cloud account and create an API Key.
- Issued certification authority
- This is needed when Account Role permission set actions are used. For example, when managing a Namespace.
Our Terraform Provider is registered with OpenTofu, but that registration is not maintained or managed by Temporal Technologies.
Setup
Generate an API Key to authenticate your requests with your Temporal Cloud account. Then use an action to create a manage your Temporal Cloud Terraform resources.
Generate an API Key
You can generate an API Key through the Temporal Web UI or through the tcld apikey create
command.
You can skip generating an API Key if you already possess a valid API Key.
Using the Temporal Web UI
- Log into the Temporal Cloud Web UI.
- Select your account name in the top right corner.
- Select API Keys from the menu.
- Choose Create API Key.
- Enter a name for your API Key.
- (optional) Provide a description.
- Set a duration for the API Key.
- Choose Generate API Key.
Using the tcld
- Use tcld to log in and generate an API Key. This API Key is used to authenticate the Terraform provider run.
# authenticate your session
tcld login
# generate an API Key
tcld apikey create -n "terraform-test" --desc "Testing the API Key for the TF Provider" -d 90d
You will use this key when creating or destroying Namespaces with the Terraform provider.
- Provide your working environment with the API Key generated in the previous step.
- macOS
- Windows
Export your environment variable for secure access to the API Keys.
# replace <yoursecretkey> with the "secretKey": output from tcld apikey create command
export TEMPORAL_CLOUD_API_KEY=<yoursecretkey>
Export your environment variable for secure access to the API Keys.
# replace <yoursecretkey> with the "secretKey": output from tcld apikey create command
set TEMPORAL_CLOUD_API_KEY=<yoursecretkey>
The TEMPORAL_CLOUD_API_KEY
is used to authenticate the Terraform provider.
- (optional) Generate your CA certificate
The CA certificate allows you to authenticate and interact with your Temporal Cloud Namespace.
You can use an existing CA cert or create one using tcld.
Once you have your CA certificate be sure to add the CA .pem
file to your working directory.
mv ca.pem test-temporal-terraform