Skip to content

Commit

Permalink
Merge pull request #675 from pulumi/friel/fwd-compat
Browse files Browse the repository at this point in the history
Ensure forward build compatibility for resource provider
  • Loading branch information
AaronFriel committed Dec 11, 2022
2 parents 6efdc4d + 4e46f2d commit b1a4e2c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 90 deletions.
6 changes: 3 additions & 3 deletions go.mod
Expand Up @@ -34,9 +34,9 @@ require (
github.com/mitchellh/reflectwalk v1.0.2
github.com/pkg/errors v0.9.1
github.com/pulumi/pulumi-java/pkg v0.6.0
github.com/pulumi/pulumi-yaml v1.0.3
github.com/pulumi/pulumi/pkg/v3 v3.48.1-0.20221207201642-68308f522cbf
github.com/pulumi/pulumi/sdk/v3 v3.48.1-0.20221207201642-68308f522cbf
github.com/pulumi/pulumi-yaml v1.0.4
github.com/pulumi/pulumi/pkg/v3 v3.49.1-0.20221210190028-cbf32d1940fa
github.com/pulumi/pulumi/sdk/v3 v3.49.1-0.20221210190028-cbf32d1940fa
github.com/pulumi/schema-tools v0.1.0
github.com/pulumi/terraform-diff-reader v0.0.0-20201211191010-ad4715e9285e
github.com/russross/blackfriday/v2 v2.1.0
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Expand Up @@ -1550,12 +1550,12 @@ github.com/prometheus/prometheus v0.37.0/go.mod h1:egARUgz+K93zwqsVIAneFlLZefyGO
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
github.com/pulumi/pulumi-java/pkg v0.6.0 h1:haiSQJlhrQIBBcR0r0aQCIF8i69e4znzRnHpaNQUchE=
github.com/pulumi/pulumi-java/pkg v0.6.0/go.mod h1:xSK2B792P8zjwYZTHYapMM1RJdue2BpRFQNYObWO0C8=
github.com/pulumi/pulumi-yaml v1.0.3 h1:JDRQfGcQYxwJETIepa7T3B7wTV7Bk2P7uApmWvQZeL4=
github.com/pulumi/pulumi-yaml v1.0.3/go.mod h1:KLFTyADnoNoPU9djMyRvXymrTH2SCBg9wnXaapuggEA=
github.com/pulumi/pulumi/pkg/v3 v3.48.1-0.20221207201642-68308f522cbf h1:I2S7oE0dUEWAEunNGv2KHRSBCF8n6QzXBTrlUrWeqEs=
github.com/pulumi/pulumi/pkg/v3 v3.48.1-0.20221207201642-68308f522cbf/go.mod h1:IomAktCnqXcRWhEex4E/vZD6Cd+YThXF3Cy/IUn3UsA=
github.com/pulumi/pulumi/sdk/v3 v3.48.1-0.20221207201642-68308f522cbf h1:+GTw1p/ReedDxKzIZyfMgj1Vp6wN2pTNu9kmr6qv5O0=
github.com/pulumi/pulumi/sdk/v3 v3.48.1-0.20221207201642-68308f522cbf/go.mod h1:n5EPRVFDh+EFwYZ+oaZmEtwgVN1A6NnI82B7ks/bmTU=
github.com/pulumi/pulumi-yaml v1.0.4 h1:p+989rW3AqkkxbzxtxccHKAN4xCJi3K2cRpvA2K84tw=
github.com/pulumi/pulumi-yaml v1.0.4/go.mod h1:Szj8ud4Vqyq3oO1n3kzIUfaP3AiCjYZM4FYjOVWwJn8=
github.com/pulumi/pulumi/pkg/v3 v3.49.1-0.20221210190028-cbf32d1940fa h1:mz0XaaXGaKJumG8vtK01p1lij7HBRXMXWBqZjfYM1wA=
github.com/pulumi/pulumi/pkg/v3 v3.49.1-0.20221210190028-cbf32d1940fa/go.mod h1:4metm4SXH718jHxL3kQwWTzyJMFEVARH4L5zF1qnCek=
github.com/pulumi/pulumi/sdk/v3 v3.49.1-0.20221210190028-cbf32d1940fa h1:lM7pipmKzPeZRfMul9tc0Ja3hX7jA/R1ZPs8osoXQeY=
github.com/pulumi/pulumi/sdk/v3 v3.49.1-0.20221210190028-cbf32d1940fa/go.mod h1:58NOiU6vEdA0S8KFiFt4/eqH7vKtWhDFsEGCUFRBovw=
github.com/pulumi/schema-tools v0.1.0 h1:o1nVQaJEnmcA+3trxe+0sIDlrILxEIOvgUQ2Ze4OFsk=
github.com/pulumi/schema-tools v0.1.0/go.mod h1:feL1siLWdcCNUm+irXoHyNHbGaqoX7pfYojpGZe2ziY=
github.com/pulumi/terraform-diff-reader v0.0.0-20201211191010-ad4715e9285e h1:Dik4Qe/+xguB8JagPyXNlbOnRiXGmq/PSPQTGunYnTk=
Expand Down
2 changes: 2 additions & 0 deletions pkg/tfbridge/provider.go
Expand Up @@ -49,6 +49,8 @@ import (

// Provider implements the Pulumi resource provider operations for any Terraform plugin.
type Provider struct {
pulumirpc.UnimplementedResourceProviderServer

host *provider.HostClient // the RPC link back to the Pulumi engine.
module string // the Terraform module name.
version string // the plugin version number.
Expand Down
83 changes: 2 additions & 81 deletions pkg/tfgen/pluginHost.go
Expand Up @@ -20,7 +20,6 @@ import (
"sync"

"github.com/blang/semver"
"github.com/pulumi/pulumi/sdk/v3/go/common/resource"
"github.com/pulumi/pulumi/sdk/v3/go/common/resource/plugin"
"github.com/pulumi/pulumi/sdk/v3/go/common/tokens"
"github.com/pulumi/pulumi/sdk/v3/go/common/workspace"
Expand All @@ -32,6 +31,8 @@ import (
var _ = (plugin.Provider)((*inmemoryProvider)(nil))

type inmemoryProvider struct {
plugin.UnimplementedProvider

name tokens.Package
schema []byte
info tfbridge.ProviderInfo
Expand Down Expand Up @@ -82,86 +83,6 @@ func (p *inmemoryProvider) GetPluginInfo() (workspace.PluginInfo, error) {
}, nil
}

func (p *inmemoryProvider) Call(tok tokens.ModuleMember, args resource.PropertyMap, info plugin.CallInfo,
options plugin.CallOptions) (plugin.CallResult, error) {
panic("unimplemented")
}

func (p *inmemoryProvider) CheckConfig(urn resource.URN, olds, news resource.PropertyMap,
allowUnknowns bool) (resource.PropertyMap, []plugin.CheckFailure, error) {
panic("unimplemented")
}

// DiffConfig checks what impacts a hypothetical change to this provider's configuration will have on the provider.
func (p *inmemoryProvider) DiffConfig(urn resource.URN, olds, news resource.PropertyMap, allowUnknowns bool,
ignoreChanges []string) (plugin.DiffResult, error) {
panic("unimplemented")
}

// Configure configures the resource provider with "globals" that control its behavior.
func (p *inmemoryProvider) Configure(inputs resource.PropertyMap) error {
panic("unimplemented")
}

func (p *inmemoryProvider) Check(urn resource.URN, olds, news resource.PropertyMap,
allowUnknowns bool, randomSeed []byte) (resource.PropertyMap, []plugin.CheckFailure, error) {
panic("unimplemented")
}

// Diff checks what impacts a hypothetical update will have on the resource's properties.
func (p *inmemoryProvider) Diff(urn resource.URN, id resource.ID, olds resource.PropertyMap, news resource.PropertyMap,
allowUnknowns bool, ignoreChanges []string) (plugin.DiffResult, error) {
panic("unimplemented")
}

// Create allocates a new instance of the provided resource and returns its unique resource.ID.
func (p *inmemoryProvider) Create(urn resource.URN, news resource.PropertyMap, timeout float64,
preview bool) (resource.ID, resource.PropertyMap, resource.Status, error) {
panic("unimplemented")
}

// Read the current live state associated with a resource. Enough state must be include in the inputs to uniquely
// identify the resource; this is typically just the resource ID, but may also include some properties. If the
// resource is missing (for instance, because it has been deleted), the resulting property map will be nil.
func (p *inmemoryProvider) Read(urn resource.URN, id resource.ID,
inputs, state resource.PropertyMap) (plugin.ReadResult, resource.Status, error) {
panic("unimplemented")
}

// Update updates an existing resource with new values.
func (p *inmemoryProvider) Update(urn resource.URN, id resource.ID,
olds resource.PropertyMap, news resource.PropertyMap, timeout float64, ignoreChanges []string,
preview bool) (resource.PropertyMap, resource.Status, error) {
panic("unimplemented")
}

// Delete tears down an existing resource.
func (p *inmemoryProvider) Delete(urn resource.URN, id resource.ID, props resource.PropertyMap,
timeout float64) (resource.Status, error) {
panic("unimplemented")
}

// Construct creates a new component resource.
func (p *inmemoryProvider) Construct(info plugin.ConstructInfo, typ tokens.Type, name tokens.QName,
parent resource.URN, inputs resource.PropertyMap, options plugin.ConstructOptions) (plugin.ConstructResult, error) {
panic("unimplemented")
}

// Invoke dynamically executes a built-in function in the provider.
func (p *inmemoryProvider) Invoke(tok tokens.ModuleMember, args resource.PropertyMap) (resource.PropertyMap,
[]plugin.CheckFailure, error) {
panic("unimplemented")
}

// StreamInvoke dynamically executes a built-in function in the provider, which returns a stream
// of responses.
func (p *inmemoryProvider) StreamInvoke(
tok tokens.ModuleMember,
args resource.PropertyMap,
onNext func(resource.PropertyMap) error) ([]plugin.CheckFailure, error) {
panic("unimplemented")
}

func (p *inmemoryProvider) Close() error {
return nil
}
Expand Down

0 comments on commit b1a4e2c

Please sign in to comment.