Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to work with Twingate terraform provider #1

Merged
merged 1 commit into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
PROJECT_NAME := xyz Package
PROJECT_NAME := twingate Package

SHELL := /bin/bash
PACK := xyz
ORG := pulumi
PACK := twingate
ORG := Twingate
PROJECT := github.com/${ORG}/pulumi-${PACK}
NODE_MODULE_NAME := @pulumi/${PACK}
TF_NAME := ${PACK}
Expand All @@ -29,13 +29,13 @@ prepare::
mv "provider/cmd/pulumi-resource-x${EMPTY_TO_AVOID_SED}yz" provider/cmd/pulumi-resource-${NAME}

if [[ "${OS}" != "Darwin" ]]; then \
sed -i 's,github.com/pulumi/pulumi-xyz,${REPOSITORY},g' provider/go.mod; \
sed -i 's,github.com/pulumi/pulumi-twingate,${REPOSITORY},g' provider/go.mod; \
find ./ ! -path './.git/*' -type f -exec sed -i 's/[x]yz/${NAME}/g' {} \; &> /dev/null; \
fi

# In MacOS the -i parameter needs an empty string to execute in place.
if [[ "${OS}" == "Darwin" ]]; then \
sed -i '' 's,github.com/pulumi/pulumi-xyz,${REPOSITORY},g' provider/go.mod; \
sed -i '' 's,github.com/pulumi/pulumi-twingate,${REPOSITORY},g' provider/go.mod; \
find ./ ! -path './.git/*' -type f -exec sed -i '' 's/[x]yz/${NAME}/g' {} \; &> /dev/null; \
fi

Expand Down Expand Up @@ -91,6 +91,9 @@ build_go:: install_plugins tfgen # build the go sdk
lint_provider:: provider # lint the provider code
cd provider && golangci-lint run -c ../.golangci.yml

tidy:: # call go mod tidy in relevant directories
find ./provider -name go.mod -execdir go mod tidy \;

cleanup:: # cleans up the temporary directory
rm -r $(WORKING_DIR)/bin
rm -f provider/cmd/${PROVIDER}/schema.go
Expand Down
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ From the templated repository:
This will do the following:
- rename folders in `provider/cmd` to `pulumi-resource-foo` and `pulumi-tfgen-foo`
- replace dependencies in `provider/go.mod` to reflect your repository name
- find and replace all instances of the boilerplate `xyz` with the `NAME` of your provider.
- find and replace all instances of the boilerplate `twingate` with the `NAME` of your provider.

Note for third-party providers:
- Make sure to set the correct GitHub organization/username in all files referencing your provider as a dependency:
Expand Down Expand Up @@ -359,7 +359,7 @@ before:
hooks:
- make tfgen
builds:
- binary: pulumi-resource-xyz
- binary: pulumi-resource-twingate
dir: provider
goarch:
- amd64
Expand All @@ -370,8 +370,8 @@ builds:
- linux
ignore: []
ldflags:
- -X github.com/pulumi/pulumi-xyz/provider/pkg/version.Version={{.Tag}}
main: ./cmd/pulumi-resource-xyz/
- -X github.com/pulumi/pulumi-twingate/provider/pkg/version.Version={{.Tag}}
main: ./cmd/pulumi-resource-twingate/
sort: asc
use: git
release:
Expand All @@ -396,18 +396,18 @@ dist
├── artifacts.json
├── config.yaml
├── metadata.json
├── pulumi-xyz_darwin_amd64_v1
│ └── pulumi-resource-xyz
├── pulumi-xyz_darwin_arm64
│ └── pulumi-resource-xyz
├── pulumi-xyz_linux_amd64_v1
│ └── pulumi-resource-xyz
├── pulumi-xyz_linux_arm64
│ └── pulumi-resource-xyz
├── pulumi-xyz_windows_amd64_v1
│ └── pulumi-resource-xyz.exe
└── pulumi-xyz_windows_arm64
└── pulumi-resource-xyz.exe
├── pulumi-twingate_darwin_amd64_v1
│ └── pulumi-resource-twingate
├── pulumi-twingate_darwin_arm64
│ └── pulumi-resource-twingate
├── pulumi-twingate_linux_amd64_v1
│ └── pulumi-resource-twingate
├── pulumi-twingate_linux_arm64
│ └── pulumi-resource-twingate
├── pulumi-twingate_windows_amd64_v1
│ └── pulumi-resource-twingate.exe
└── pulumi-twingate_windows_arm64
└── pulumi-resource-twingate.exe
```

Any of the provider binaries can be used to target the correct machine architecture
Expand Down
6 changes: 3 additions & 3 deletions deployment-templates/.goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ before:
hooks:
- make tfgen
builds:
- binary: pulumi-resource-xyz
- binary: pulumi-resource-twingate
dir: provider
env:
- CGO_ENABLED=0
Expand All @@ -18,8 +18,8 @@ builds:
- linux
ldflags:
# The line below MUST align with the module in current provider/go.mod
- -X github.com/your-org-name/pulumi-xyz/provider/pkg/version.Version={{.Tag }}
main: ./cmd/pulumi-resource-xyz/
- -X github.com/your-org-name/pulumi-twingate/provider/pkg/version.Version={{.Tag }}
main: ./cmd/pulumi-resource-twingate/
changelog:
skip: true
release:
Expand Down
9 changes: 9 additions & 0 deletions docs/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: Twingate
meta_desc: Provides an overview of the Twingate Provider for Pulumi.
layout: overview
---

The Twingate provider for Pulumi can be used to provision any of the cloud resources available in Twingate.

The Twingate provider must be configured with credentials to deploy and update resources in Twingate.
36 changes: 36 additions & 0 deletions docs/installation-configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
title: Twingate Installation & Configuration
meta_desc: Information on how to install the Twingate provider.
layout: installation
---

## 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)


## Configuration

> Note:
> Replace the following **sample content**, with the configuration options
> of the wrapped Terraform provider and remove this note.

The following configuration points are available for the `twingate` provider:

- `twingate:apiKey` (environment: `twingate_API_KEY`) - the API key for `twingate`
- `twingate:region` (environment: `twingate_REGION`) - the region in which to deploy resources

### Provider Binary

The Twingate provider binary is a third party binary. It can be installed using the `pulumi plugin` command.

```bash
pulumi plugin install resource twingate <version>
```

Replace the version string `<version>` with your desired version.
2 changes: 1 addition & 1 deletion examples/go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/pulumi/pulumi-xyz/examples
module github.com/Twingate/pulumi-twingate/examples

go 1.21
Empty file.
Loading
Loading