Deploying Twingate via Pulumi
by Emrul Islam

Deploying Twingate via Pulumi

We’re excited to officially partner with Pulumi, a leading multi-language infrastructure as code platform loved by innovative companies and developers all over the world. With Pulumi’s flexible, open source cloud engineering platform, devops teams can deploy and maintain Twingate connectors programmatically across public cloud environments like AWS, GCP, Azure, and many more cloud ISVs.

Pulumi allows developers to automate their infrastructure using languages that they are already proficient in. This makes managing infrastructure simpler and possible whether developers prefer to use Python, TypeScript, JavaScript, Go or .NET. Their efforts to make infrastructure as code accessible married with our focus on easy implementation of zero trust gets us excited about the future of the partnership!

Below is a step by step guide to deploying Twingate connectors via Pulumi and we’re excited to announce that as of today you can find the Twingate package directly within Pulumi’s registry.

This is just the first phase of our partnership and we’re looking forward to continuing to develop on top of Pulumi’s advancements within their modern Infrastructure as code (IaC) frameworks!

How to deploy Twingate via Pulumi

Step 1 - Install Pulumi

Follow the steps appropriate for your operating system. An install guide is available on the Pulumi documentation site here.

Step 2 - Initialize a new Pulumi project

Below we create an typescript template and install the pulumi-twingate provider for JavaScript. For JavaScript the main commands are pulumi new typescript and npm install @twingate-labs/pulumi-twingate.

Step 3 - Set Twingate configuration parameters

In order to use the Twingate Pulumi provider, you need to set a Twingate API Token and a network. These can be obtained from the Twingate Admin Console and then set either via environment variable or stored within Pulumi. We are going to store them within Pulumi:

pulumi config set twingate:network "XXXX"
pulumi config set twingate:apiToken "YYYYY" --secret

Step 4 - Begin automating

We can edit the index.ts file and try the following example to create a remote network within Twingate:

import { TwingateRemoteNetwork } from "@twingate-labs/pulumi-twingate";

const awsNetwork = new TwingateRemoteNetwork("aws_network");

Step 5 - Execute the automation

Now we are ready to test our script we can run pulumi up to do so.

Interested in learning more? We would love to talk with you. You can contact us here.


Featured Articles