Terraform
- Terraform Enterprise
- 1.0.x (latest)
- v202506-1
- v202505-1
- v202504-1
- v202503-1
- v202502-2
- v202502-1
- v202501-1
- v202411-2
- v202411-1
- v202410-1
- v202409-3
- v202409-2
- v202409-1
- v202408-1
- No versions of this document exist before v202408-1. Click below to redirect to the version homepage.
- v202407-1
- v202406-1
- v202405-1
- v202404-2
- v202404-1
- v202402-2
- v202402-1
- v202401-2
- v202401-1
- v202312-1
- v202311-1
- v202310-1
- v202309-1
- v202308-1
- v202307-1
- v202306-1
- v202305-2
- v202305-1
- v202304-1
- v202303-1
- v202302-1
- v202301-2
- v202301-1
- v202212-2
- v202212-1
- v202211-1
- v202210-1
- v202209-2
- v202209-1
- v202208-3
- v202208-2
- v202208-1
- v202207-2
- v202207-1
- v202206-1
Increase number of replica instances
This topic describes how to increase the number of replica instances of your Terraform Enterprise deployment on Kubernetes so that your deployment can scale to meet demand.
Introduction
To handle increased computational workload requirements of your organization, you can scale Terraform Enterprise horizontally by increasing the number of terraform-enterprise pods and terraform-enterprise agent pods. Refer to the Scale Terraform Enterprise instances on Kubernetes overview for additional information.
Requirements
The requirements for your Kubernetes cluster depend on the specific workloads. Update CPU, RAM, storage, and network capacity according to your applications demands.
CPU requirements
The following minimum requirements for a Terraform Enterprise pod are appropriate for most initial production deployments and for development and test environments:
| CPU | Memory | 
|---|---|
| 2 core | 3 GB RAM | 
We tested with a minimum memory of 2.5GB and 0.75 vCPU and scaled up to maximum of 7.5GB and 4 vCPU.
resources:
   requests:
     memory: "2500Mi"
     cpu: "750m"
   limits:
     memory: "7500Mi"
     cpu: "4000m"
Database requirements
The following table describes the recommended minimum memory and CPU requirements for the PostgreSQL database. You may require additional resources depending on the anticipated demands on Terraform Enterprise within your organization:
| Type | CPU | Memory | Storage | 
|---|---|---|---|
| Minimum | 4 core | 16 GB RAM | 50 GB | 
| Scaling | 8 core | 32 GB RAM | 50 GB | 
Redis cache requirements
We successfully tested Terraform Enterprise with the following data store configuration:
- 6GB Redis cache.
- Multi-AZ enabled.
- Automated failover enabled.
Increase terraform-enterprise pods
Kubernetes creates a Deployment object that manages the terraform-enterprise pods through a ReplicaSet. Refer to the Kubernetes documentation to learn about Deployments and ReplicaSets.
The deployment.yaml file generated during the Terraform Enterprise deployment process includes the replicas field, which determines how many terraform-enterprise pods Kubernetes should create. 
apiVersion: apps/v1
kind: Deployment
metadata:
  name: terraform-enterprise
  labels:
    app: terraform-enterprise
spec:
  replicas: {{ .Values.replicaCount }}
  selector:
    matchLabels:
      app: terraform-enterprise
  template:
    metadata:
      annotations:
    {{- if .Values.pod.annotations }}
    {{ toYaml .Values.pod.annotations | indent 8 }}
    {{ end }}
      labels:
        app: terraform-enterprise
Complete the following steps to increase the number of terraform-enterprise pods for your deployment: 
- Update the value of replicaCountin the values file of your Helm chart. ThereplicaCountvalue maps to thespec.replicasvalue in the deployment file. The maximum number ofterraform-enterprisepods you can instruct Kuberneteds to create is5.
- Run the helm upgradecommand to update the deployment.
In the following example, the replicaCount is set to 3, which sets the spec.replicas value to 3 after running helm ugrade:
  replicaCount: 3
  ...