Skip to content

Commit ad66638

Browse files
authored
Document provider layering, with impl guides (#16630)
* Document provider layering, with impl guides Today we do not really explain the layering of our various means of writing providers, which as we've seen, can lead to confusion. This does a pass over the provider authoring docs, explaining the architecture, and why only Go has a higher level SDK. It also adds reference material and implementation guides for those who want to code to the direct gRPC/Protobuf interfaces directly, in Python, Go, or TypeScript. (These were tested locally.) I am not 100% convinced we should add this but for power users wanting to really understand how providers work and how to author them, it would seem helpful in demystifying some confusing aspects of our ecosystem. * Address code review feedback * Minor fix found when testing
1 parent b04b3ab commit ad66638

File tree

9 files changed

+2155
-10
lines changed

9 files changed

+2155
-10
lines changed

content/docs/iac/guides/building-extending/providers/build-a-provider.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ h1: Build a Provider
66
meta_image: /images/docs/meta-images/docs-meta.png
77
menu:
88
iac:
9-
name: Build a Provider
9+
name: Build a provider
1010
parent: iac-guides-providers
1111
weight: 30
1212
aliases:
@@ -15,6 +15,10 @@ aliases:
1515
- /docs/iac/build-with-pulumi/build-a-provider/
1616
---
1717

18+
{{% notes type="info" %}}
19+
This guide uses the [Pulumi Go Provider SDK](/docs/iac/guides/building-extending/providers/sdks/pulumi-go-provider-sdk/) (Layer 3 in the [provider architecture](/docs/iac/guides/building-extending/providers/provider-architecture/)). If you prefer to implement providers directly using gRPC bindings for full control, or need to use a language other than Go, see [Direct provider implementation](/docs/iac/guides/building-extending/providers/implementers/).
20+
{{% /notes %}}
21+
1822
## When to use a provider
1923

2024
A Pulumi Provider allows you to define new resource types, enabling integration with virtually any service or tool. Pulumi providers are ideal when you need to manage resources that are not yet supported by existing Pulumi providers or when you require custom behavior for managing external systems or APIs. Providers are a powerful extension point, but before building a full provider consider if your use case can be covered by [building a component](/docs/iac/using-pulumi/extending-pulumi/build-a-component/) or using [dynamic provider functions](/docs/iac/concepts/resources/dynamic-providers/).
@@ -59,9 +63,11 @@ Historically it was necessary to hand-author and maintain the `schema.json` file
5963

6064
{{% /notes %}}
6165

62-
## Language support and the Pulumi Provider SDK
66+
## Language support and the Pulumi Go Provider SDK
67+
68+
Pulumi providers can be written in any language that supports gRPC, and used in any Pulumi program regardless of that program's language. The provider [architecture](/docs/iac/guides/building-extending/providers/provider-architecture/) has multiple layers. Layer 3 is the [Pulumi Go Provider SDK](/docs/iac/guides/building-extending/providers/sdks/pulumi-go-provider-sdk/)—the most streamlined approach for Go. Layer 2 lets you implement the gRPC interface directly in [Python](/docs/iac/guides/building-extending/providers/implementers/python/), Go, TypeScript, or any language with gRPC support.
6369

64-
Pulumi providers can be written in Go, TypeScript, .NET, and Java, and used in any Pulumi program, in any supported language. The [Pulumi Provider SDK](/docs/iac/using-pulumi/extending-pulumi/pulumi-provider-sdk/) is a framework for building providers in Go. We strongly recommend using the SDK, as it is the most full-featured and streamlined way to create a new provider.
70+
We recommend using the Pulumi Go Provider SDK for Go providers, as it handles protocol complexity and generates schemas automatically. For other languages, or when you need full control over your schema and data structure mappings, use the [direct implementation](/docs/iac/guides/building-extending/providers/implementers/) approach.
6571

6672
Some advantages of using the Pulumi Provider SDK:
6773

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
title_tag: "Direct provider implementation"
3+
meta_desc: "Implement Pulumi providers directly using gRPC bindings, without higher-level SDKs."
4+
title: Direct provider implementation
5+
h1: Direct provider implementation
6+
meta_image: /images/docs/meta-images/docs-meta.png
7+
menu:
8+
iac:
9+
name: Direct implementation
10+
identifier: iac-guides-provider-implementers
11+
parent: iac-guides-providers
12+
weight: 50
13+
---
14+
15+
This section covers implementing Pulumi providers directly using the generated gRPC bindings—Layer 2 in the [provider architecture](/docs/iac/guides/building-extending/providers/provider-architecture/).
16+
17+
## When to use direct implementation
18+
19+
Direct implementation gives you full control over provider behavior without SDK opinions. Choose this approach when your language lacks a higher-level SDK (such as Python or TypeScript), when you need precise control over Check/Diff/Update behavior, when you're building something unusual that doesn't fit standard patterns, or when you want to understand exactly how providers work at the protocol level.
20+
21+
## What you'll need
22+
23+
You'll need gRPC bindings for your language (generated from `provider.proto`), a hand-written schema defining your resources and their properties, and implementations of the provider interface methods.
24+
25+
## Trade-offs
26+
27+
| Aspect | Direct implementation | Higher-level SDK |
28+
|--------|----------------------|------------------|
29+
| Control | Full | Framework-guided |
30+
| Boilerplate | More | Less |
31+
| Schema | Hand-written JSON | Inferred from code |
32+
| Learning curve | Protocol knowledge | SDK patterns |
33+
34+
## Guides
35+
36+
- [Protocol reference](/docs/iac/guides/building-extending/providers/implementers/protocol-reference/) - Complete gRPC method documentation
37+
- [Python](/docs/iac/guides/building-extending/providers/implementers/python/) - Implement a provider in Python
38+
- [Go](/docs/iac/guides/building-extending/providers/implementers/go/) - Implement a provider in Go without the SDK
39+
- [TypeScript](/docs/iac/guides/building-extending/providers/implementers/typescript/) - Implement a provider in TypeScript
40+
41+
## Related resources
42+
43+
- [Provider architecture](/docs/iac/guides/building-extending/providers/provider-architecture/) - Understanding the layers
44+
- [Schema reference](/docs/iac/guides/building-extending/packages/schema/) - Complete schema documentation
45+
- [Pulumi Go Provider SDK](/docs/iac/guides/building-extending/providers/sdks/pulumi-go-provider-sdk/) - Higher-level Go SDK

0 commit comments

Comments
 (0)