diff --git a/CHANGELOG.md b/CHANGELOG.md index 431e68b8d..8ecefe627 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,12 +2,16 @@ ### Improvements +- Issue a more perscriptive error when using StackReference and the name of the stack to reference is not of the form `//`. + ## 0.16.12 (Released January 25th, 2019) ### Major Changes - When using the cloud backend, stack names now must only be unique within a project, instead of across your entire account. Starting with version of 0.16.12 the CLI, you can create stacks with duplicate names. If an account has multiple stacks with the same name across different projects, you must use 0.16.12 or later of the CLI to manage them. +**BREAKING CHANGE NOTICE**: As part of the above change, when using the 0.16.12 CLI (or a later version) the names passed to `StackReference` must be updated to be of the form (`//`) e.g. `acmecorp/infra/dev` to refer to the `dev` stack of the `infra` project in the `acmecorp` organization. + ### Improvements - Add `--json` to `pulumi config`, `pulumi config get`, `pulumi history` and `pulumi plugin ls` to request the output be in JSON. diff --git a/pkg/backend/httpstate/backend.go b/pkg/backend/httpstate/backend.go index 48071d2b1..f3992aec5 100644 --- a/pkg/backend/httpstate/backend.go +++ b/pkg/backend/httpstate/backend.go @@ -47,6 +47,7 @@ import ( "github.com/pulumi/pulumi/pkg/diag/colors" "github.com/pulumi/pulumi/pkg/engine" "github.com/pulumi/pulumi/pkg/operations" + "github.com/pulumi/pulumi/pkg/resource" "github.com/pulumi/pulumi/pkg/resource/config" "github.com/pulumi/pulumi/pkg/resource/deploy" "github.com/pulumi/pulumi/pkg/tokens" @@ -811,7 +812,7 @@ func (b *cloudBackend) runEngineAction( Cancel: cancellationScope.Context(), Events: engineEvents, SnapshotManager: snapshotManager, - BackendClient: backend.NewBackendClient(b), + BackendClient: httpstateBackendClient{backend: b}, } if parentSpan := opentracing.SpanFromContext(ctx); parentSpan != nil { engineCtx.ParentSpan = parentSpan.Context() @@ -1222,3 +1223,18 @@ func (b *cloudBackend) UpdateStackTags(ctx context.Context, return b.client.UpdateStackTags(ctx, stack, tags) } + +type httpstateBackendClient struct { + backend Backend +} + +func (c httpstateBackendClient) GetStackOutputs(ctx context.Context, name string) (resource.PropertyMap, error) { + // When using the cloud backend, require that stack references are fully qualified so they + // look like "//" + if strings.Count(name, "/") != 2 { + return nil, errors.Errorf("a stack reference's name should be of the form " + + "'//'. See https://pulumi.io/help/stack-reference for more information.") + } + + return backend.NewBackendClient(c.backend).GetStackOutputs(ctx, name) +}