generated from pulumi/pulumi-tf-provider-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
df39950
commit 6194eaf
Showing
96 changed files
with
1,999 additions
and
2,107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,74 @@ | ||
--- | ||
title: Twingate | ||
meta_desc: Provides an overview of the Twingate Provider for Pulumi. | ||
layout: overview | ||
layout: package | ||
--- | ||
|
||
The Twingate provider for Pulumi can be used to provision any of the cloud resources available in Twingate. | ||
|
||
The Twingate provider for Pulumi can be used to provision any of the cloud resources available in [Twingate](https://www.twingate.com/). | ||
The Twingate provider must be configured with credentials to deploy and update resources in Twingate. | ||
|
||
## Example | ||
|
||
{{< chooser language "typescript,python,csharp" >}} | ||
{{% choosable language typescript %}} | ||
|
||
```typescript | ||
import * as tg from "@twingate-labs/pulumi-twingate" | ||
import * as pulumi from "@pulumi/pulumi" | ||
|
||
const remoteNetwork = new tg.TwingateRemoteNetwork("test-network", {name: "Pulumi Test Network"}) | ||
const serviceAccount = new tg.TwingateServiceAccount("ci_cd_account", {name: "CI CD Service"}) | ||
const serviceAccountKey = new tg.TwingateServiceAccountKey("ci_cd_key", {name: "CI CD Key", serviceAccountId: serviceAccount.id}) | ||
|
||
// To see serviceAccountKeyOut, execute command `pulumi stack output --show-secrets` | ||
export const serviceAccountKeyOut = pulumi.interpolate`${serviceAccountKey.token}`; | ||
|
||
// get group id by name | ||
function getGroupId(groupName: string){ | ||
const groups:any = tg.getTwingateGroupsOutput({name: groupName})?.groups ?? [] | ||
return groups[0].id | ||
} | ||
|
||
new tg.TwingateResource("test_resource", { | ||
name: "Twingate Home Page", | ||
address: "www.twingate.com", | ||
remoteNetworkId: remoteNetwork.id, | ||
access: { | ||
groupIds: [getGroupId("Everyone")], | ||
serviceAccountIds: [serviceAccount.id] | ||
} | ||
}) | ||
``` | ||
|
||
{{% /choosable %}} | ||
{{% choosable language python %}} | ||
|
||
```python | ||
import pulumi | ||
import pulumi_twingate as tg | ||
|
||
remote_network = tg.TwingateRemoteNetwork("test_network", name="Pulumi Test Network") | ||
service_account = tg.TwingateServiceAccount("ci_cd_account", name="CI CD Service") | ||
service_account_key = tg.TwingateServiceAccountKey("ci_cd_key", name="CI CD Key", service_account_id=service_account.id) | ||
|
||
# To see service_account_key, execute command `pulumi stack output --show-secrets` | ||
pulumi.export("service_account_key", service_account_key.token) | ||
|
||
|
||
# Get group id by name | ||
def get_group_id(group_name): | ||
group = tg.get_twingate_groups_output(name=group_name).groups[0] | ||
return group.id | ||
|
||
|
||
twingate_resource = tg.TwingateResource("test_resource", | ||
name="Twingate Home Page", | ||
address="www.twingate.com", | ||
remote_network_id=remote_network.id, | ||
access={"group_ids": [get_group_id("Everyone")], | ||
"service_account_ids": [service_account.id]} | ||
) | ||
``` | ||
|
||
{{% /choosable %}} | ||
{{< /chooser >}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,71 @@ | ||
--- | ||
title: Twingate Installation & Configuration | ||
meta_desc: Information on how to install the Twingate provider. | ||
layout: installation | ||
layout: package | ||
--- | ||
|
||
## Installation | ||
|
||
The Pulumi Twingate provider is available as a package in all Pulumi languages: | ||
|
||
* JavaScript/TypeScript: [`@pulumiverse/twingate`](https://www.npmjs.com/package/@pulumiverse/twingate) | ||
* Python: [`pulumiverse_twingate`](https://pypi.org/project/pulumiverse_twingate/) | ||
* Go: [`github.com/pulumiverse/pulumi-twingate/sdk/go/twingate`](https://pkg.go.dev/github.com/pulumiverse/pulumi-twingate/sdk/go/twingate) | ||
* .NET: [`Pulumiverse.Twingate`](https://www.nuget.org/packages/Pulumiverse.Twingate) | ||
* JavaScript/TypeScript: [`@twingate-labs/pulumi-twingate`](https://www.npmjs.com/package/@twingate-labs/pulumi-twingate) | ||
* Python: [`pulumi_twingate`](https://pypi.org/project/pulumi-twingate/) | ||
* Go: [`github.com/Twingate-Labs/pulumi-twingate/sdk/go/twingate`](https://github.com/Twingate-Labs/pulumi-twingate/tree/master/sdk/go/twingate) | ||
* .NET: [`TwingateLabs.Twingate`](https://www.nuget.org/packages/TwingateLabs.Twingate) | ||
|
||
### Provider Binary | ||
|
||
## Configuration | ||
The Twingate provider binary is a third party binary, this should be installed automatically by package managers (e.g. Python Pip). It can be manually installed using the `pulumi plugin` command. | ||
|
||
> Note: | ||
> Replace the following **sample content**, with the configuration options | ||
> of the wrapped Terraform provider and remove this note. | ||
```bash | ||
pulumi plugin install resource twingate --server github://api.github.com/twingate-labs | ||
``` | ||
|
||
The following configuration points are available for the `twingate` provider: | ||
Replace the version string with your desired version. | ||
|
||
- `twingate:apiKey` (environment: `twingate_API_KEY`) - the API key for `twingate` | ||
- `twingate:region` (environment: `twingate_REGION`) - the region in which to deploy resources | ||
## Setup | ||
|
||
### Provider Binary | ||
To provision resources with the Pulumi Twingate provider, you need to have Twingate credentials. | ||
|
||
### Set environment variables | ||
|
||
Once you have provisioned these credentials, you can set environment variables to provision resources in Twingate: | ||
|
||
{{< chooser os "linux,macos,windows" >}} | ||
{{% choosable os linux %}} | ||
|
||
```bash | ||
$ export TWINGATE_API_TOKEN=<TWINGATE_API_TOKEN> | ||
$ export TWINGATE_NETWORK=<TWINGATE_NETWORK> | ||
``` | ||
|
||
{{% /choosable %}} | ||
|
||
The Twingate provider binary is a third party binary. It can be installed using the `pulumi plugin` command. | ||
{{% choosable os macos %}} | ||
|
||
```bash | ||
pulumi plugin install resource twingate <version> | ||
$ export TWINGATE_API_TOKEN=<TWINGATE_API_TOKEN> | ||
$ export TWINGATE_NETWORK=<TWINGATE_NETWORK> | ||
``` | ||
|
||
Replace the version string `<version>` with your desired version. | ||
{{% /choosable %}} | ||
|
||
{{% choosable os windows %}} | ||
|
||
```powershell | ||
> $env:TWINGATE_API_TOKEN = "<TWINGATE_API_TOKEN>" | ||
> $env:TWINGATE_NETWORK = "<TWINGATE_NETWORK>" | ||
``` | ||
|
||
{{% /choosable %}} | ||
{{< /chooser >}} | ||
|
||
If you prefer that they be stored alongside your Pulumi stack for easy multi-user access: | ||
|
||
```bash | ||
$ pulumi config set twingate:apiToken XXXXXX --secret | ||
$ pulumi config set twingate:network YYYYYY | ||
``` | ||
|
||
The complete list of | ||
configuration parameters is in the [Twingate provider README](https://github.com/Twingate-Labs/pulumi-twingate/blob/master/README.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
.pulumi/ | ||
**/bin/ | ||
node_modules/ | ||
|
||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/bin/ | ||
/__pycache__/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
config: | ||
aws:region: eu-west-1 | ||
demo-connector:data: | ||
active: true | ||
tg_remote_network: aws_application_vpc | ||
vpc_name: aws_application_vpc | ||
vpc_cidr: 10.0.0.0/16 | ||
prv_subnet_name: private_subnet | ||
pub_subnet_name: public_subnet | ||
prv_cidr: 10.0.1.0/24 | ||
pub_cidr: 10.0.2.0/24 | ||
eip_name: eip | ||
igw_name: igw | ||
natgw_name: ngw | ||
pubrttable_name: pubrttable | ||
prvrttable_name: prvrttable | ||
pubrtasst_name: pub_rt_asst | ||
prvrtasst_name: prv_rt_asst | ||
sec_grp_name: egress_sec_grp | ||
key_name: connector_ssh_key | ||
ec2_type: t2.micro | ||
connectors: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
name: demo-connector | ||
runtime: | ||
name: python | ||
description: Example script for deploying multiple Twingate connectors to AWS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Connector AWS | ||
This example demonstrates how to deploy Twingate connectors to AWS EC2 instances. | ||
|
||
## Pre-requisite | ||
* Python and PIP | ||
* Pulumi | ||
* AWS CLI | ||
|
||
## How to Use | ||
* Clone the repository | ||
* `cd /path/to/repo/examples/connector-aws-ec2` | ||
* Configure Pulumi-Twingate Provider, see configuration section [here](../../README.md) | ||
* Setup AWS CLI, see [here](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-quickstart.html) | ||
* `cp pulumi.dev.yaml.example pulumi.dev.yaml` and modify `pulumi.dev.yaml` to desired values including number of connectors to deploy. | ||
* `pulumi up` | ||
|
||
**Note**: `pulumi up` should automatically download the required Python dependency and Pulumi Plugins. | ||
|
||
**Note**: make sure `dev` part in the file name of `pulumi.dev.yaml` is changed to the Pulumi stack name. | ||
|
||
## How to Update Connectors | ||
`pulumi up` would trigger VM replacement with the latest connector AMI version (if newer version exist). | ||
|
||
**Note**: Connector update can cause the existing connection to be interrupted. |
Oops, something went wrong.