Skip to content

Instantly share code, notes, and snippets.

@usrbinkat
Created October 10, 2023 19:55
Show Gist options
  • Save usrbinkat/33ed6a27e0ec41f2447784cbbfcd4d78 to your computer and use it in GitHub Desktop.
Save usrbinkat/33ed6a27e0ec41f2447784cbbfcd4d78 to your computer and use it in GitHub Desktop.
Pulumi Native Provider

Pulumi Native Provider Boilerplate

Introduction

  • Repo: pulumi/pulumi-provider-boilerplate

  • Purpose: Boilerplate for creating native Pulumi providers.

  • Languages: Go, TypeScript, Python, .NET

  • Directory Structure

    • /provider: Core logic for the custom Pulumi provider.
      • provider.go: Main provider logic.
    • cmd/pulumi-resource-xyz/main.go: Entry point for the resource.
    • /sdk: SDKs for different languages.
    • /go: Go SDK.
    • /dotnet: .NET SDK.
    • /nodejs: Node.js SDK.
    • /python: Python SDK.
    • /examples: Example Pulumi programs.
    • /simple: A simple example with essential files.
    • /deployment-templates: Templates for deployment.
      • .goreleaser.yml: GoReleaser configuration.
      • release.yml: GitHub Actions for release.
    • /tests: Test scripts.
      • provider_test.go: Tests for the provider logic.

Quick Commands

  1. Clone Repo: git clone https://github.com/usrbinkat/pulumi-kind.git
  2. Build Provider: make build
  3. Run Tests: make test
  4. Deploy: make deploy

Creating a New Native Provider

  1. Clone Boilerplate: Clone the pulumi-kind repo.
  2. Modify provider.go: Add your custom logic.
  3. Add Resources: Create new resource files in /provider.
  4. Update SDKs: Reflect changes in the /sdk directory for all languages.
  5. Test: Write and run tests.
  6. Deploy: Use the deployment templates.

Working with SDKs

  • Go: Modify /sdk/go/xyz/provider.go and /sdk/go/xyz/random.go.
  • .NET: Update /sdk/dotnet/Provider.cs and /sdk/dotnet/Random.cs.
  • Node.js: Edit /sdk/nodejs/provider.ts and /sdk/nodejs/random.ts.
  • Python: Change /sdk/python/pulumi_xyz/provider.py and /sdk/python/pulumi_xyz/random.py.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment