From 056c82cd09baa79ac20df7782aec1d044068d4e8 Mon Sep 17 00:00:00 2001 From: Paul Stack Date: Wed, 4 Nov 2020 01:14:43 +0000 Subject: [PATCH] Ensure CLI doesn't panic when using pulumi watch and ComponentResources (#5675) --- CHANGELOG.md | 4 ++++ pkg/operations/resources.go | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93feec6ca..736921dbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,12 @@ CHANGELOG - Add internal scaffolding for using cross-language components from Go. [#5558](https://github.com/pulumi/pulumi/pull/5558) + - Support python 3.9. [#5669](https://github.com/pulumi/pulumi/pull/5669) + +- [cli] Ensure that the CLI doesn't panic when using pulumi watch and using ComponentResources with non-standard naming + [#5675](https://github.com/pulumi/pulumi/pull/5675) ## 2.12.1 (2020-10-23) diff --git a/pkg/operations/resources.go b/pkg/operations/resources.go index 1723488b5..2c0c423cd 100644 --- a/pkg/operations/resources.go +++ b/pkg/operations/resources.go @@ -16,6 +16,7 @@ package operations import ( "sort" + "strings" "github.com/hashicorp/go-multierror" "github.com/pulumi/pulumi/sdk/v2/go/common/resource" @@ -249,6 +250,12 @@ func (ops *resourceOperations) getOperationsProvider() (Provider, error) { if ops.resource == nil || ops.resource.State == nil { return nil, nil } + + tokenSeparators := strings.Count(ops.resource.State.Type.String(), ":") + if tokenSeparators != 2 { + return nil, nil + } + switch ops.resource.State.Type.Package() { case "cloud": return CloudOperationsProvider(ops.config, ops.resource)