---
title: "Deploy a cloudSwXtch on Azure via Terraform"
slug: "deploy-cloudswxtch-terraform-azure"
updated: 2025-11-10T22:30:41Z
published: 2024-06-07T18:28:15Z
canonical: "docs.swxtch.io/deploy-cloudswxtch-terraform-azure"
---

> ## Documentation Index
> Fetch the complete documentation index at: https://docs.swxtch.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy a cloudSwXtch on Azure via Terraform

WHAT TO EXPECT

By default, the terraform script will spin up a "small" cloudSwXtch. You can make edits to the Azure/terraform/terraform.tfvarse file to declare a different cloudSwXtch size. There is also an option to delegate static ip addresses on your cloudSwXtch. Further details on how to do this can be found at the end of this article.

### Deploying cloudSwXtch with Terraform on Azure

1. Sign-in to your Azure portal under the subscription where you want to deploy the cloudSwXtch.
2. Open the Azure Cloud Shell interface and select the Bash environment as shown.

![shell11](https://cdn.document360.io/84c5db44-f675-4f33-a980-5d3fc63073ca/Images/Documentation/shell1%281%29.png)

1. Clone the example repository from [GitHub](https://github.com/swxtchio/cloudSwXtch-support).

You can do this either **via SSH** (requires setting up your SSH authentication with GitHub ):

```shell
$ git clone git@github.com:swxtchio/cloudSwXtch-support.git
```

**or via HTTPS**:

```shell
$ git clone https://github.com/swxtchio/cloudSwXtch-support.git
```

1. Update the values in the Azure/terraform/terraform.tfvarse file to match your existing azure resources such as: resource group, virtual network, subnets, etc.

> [!WARNING]
> The format of the key file that the scripts can process is the ssh-rsa type. The content of the file should start with "ssh-rsa AAAAB3..."

1. In the Cloud Shell terminal, cd into the Azure/terraform directory and initialize the terraform environment:

```shell
$ cd Azure/terraform
$ terraform init
```

![image.png](https://cdn.document360.io/84c5db44-f675-4f33-a980-5d3fc63073ca/Images/Documentation/image%2849%29.png)

1. Now that Terraform has been initialized, run this command to evaluate the config and confirm the desired output which will be shown:

```shell
$ terraform plan
```

![image.png](https://cdn.document360.io/84c5db44-f675-4f33-a980-5d3fc63073ca/Images/Documentation/image%2851%29.png)

> [!WARNING]
> Since you are using all pre-existing resources to deploy your cloudSwXtch, there should only be 3 resources added - 1 cloudSwxtch, and 2 NICs - as can be seen at the bottom of the screenshot, “Plan: 3 to add, 0 to change, 0 to destroy.”

1. Run the Terraform apply command (followed by “yes” when prompted) to approve the action.

```shell
Terraform apply
yes
```

1. Once the resources have applied successfully you can view the resources created from your Azure portal as confirmation of a successful deployment.

**STATIC IPs**

If you'd like to deploy a cloudSwXtch using Static IPs, then you just need to make some small changes to the azure_deployswxtch.tf & terraform.tfvars files.

1. Un-comment the Parameter private_ip_address in the azure_deployswxtch.tf code file for both your data_network_interface & control_network_interface resources.

![networkinterface_staticip1](https://cdn.document360.io/84c5db44-f675-4f33-a980-5d3fc63073ca/Images/Documentation/networkinterface_staticip%281%29.PNG)

1. Set the parameter private_ip_address_allocation to "Static".

Your 2 lines of code should look like below for both network interface resources:

```shell
private_ip_address_allocation = “Static”
private_ip_address = var.datanic_staticip
```

Your terraform.tfvars file will have variables defined for your control and data NIC StaticIP definitions. You can update those values based on your subnet setup.

***Note:*** This static IP address allocation will only work for swxtch_count of 1.
