pulumi/cmd/pulumi-test-language/tests/testdata/l1-builtin-try
Brandon Pollack 0a6d2ad2be
Implement a first version of `try` in PCL (#18454)
[Terraform's `try`
function](https://developer.hashicorp.com/terraform/language/functions/try)
accepts a variable number of arguments (of variable types) and returns
the first that does not throw an error when evaluated. This change takes
a first pass at adding `try` to PCL, in an effort to support better
conversion from Terraform to Pulumi programs. It makes the following
contributions:

* PCL gets a new `try` function, which takes a single argument which is
a list/tuple of expressions to be tried.

* Code generation for NodeJS and Python has been extended to support a
naive first implementation of `try`. Both implementations rely on these
languages being dynamic under the hood. A Go implementation is not
currently provided and its omission is tracked by #18506.

* A conformance test, `l1-builtin-try`, has been added to exercise the
NodeJS and Python implementations. It is skipped in Go with a reference
to the aforementioned tracking issue.

When this has merged, we can look at extending
`pulumi-converter-terraform` to generate applications of `try`, which
should enable us to make progress converting a number of popular
Terraform modules and programs.

Part of #18350

Co-authored-by: Will Jones <will@sacharissa.co.uk>
2025-02-11 15:34:56 +00:00
..
main.pp Implement a first version of `try` in PCL (#18454) 2025-02-11 15:34:56 +00:00