Output key and correct stack on keynotfound (#5740)

* Output key and correct stack on keynotfound

Co-authored-by: Mikhail Shilkov <github@mikhail.io>
This commit is contained in:
Tomas Jansson 2020-11-17 19:58:56 +01:00 committed by GitHub
parent bfe4969f35
commit 89daaa2ff1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View file

@ -36,6 +36,9 @@ CHANGELOG
- .NET: Report plugin install errors during `pulumi new`.
[#5760](https://github.com/pulumi/pulumi/pull/5760)
- Correct error message on KeyNotFoundException against StackReference.
[#5740](https://github.com/pulumi/pulumi/pull/5740)
## 2.13.2 (2020-11-06)
- Fix a bug that was causing errors when (de)serializing custom resources.

View file

@ -72,11 +72,12 @@ namespace Pulumi
public Output<object> RequireOutput(Input<string> name)
{
var inputs = (Input<ImmutableDictionary<string, object>>)this.Outputs;
var value = Output.Tuple(name, inputs).Apply(v =>
v.Item2.TryGetValue(v.Item1, out var result)
var stackName = (Input<string>)this.Name;
var value = Output.Tuple(name, stackName, inputs).Apply(v =>
v.Item3.TryGetValue(v.Item1, out var result)
? result
: throw new KeyNotFoundException(
$"Required output '{name}' does not exist on stack '{Deployment.Instance.StackName}'."));
$"Required output '{v.Item1}' does not exist on stack '{v.Item2}'."));
return value.WithIsSecret(IsSecretOutputName(name));
}