cuddly-engineer-30016
05/10/2024, 10:12 AMExtraFunctions
is a thing although i am not sure how to implement it. Would it be possible to implement this extra function in the TF provider as an ExtraFunction
? Could we add another function to parse an unix timestamp too?limited-rainbow-51650
05/10/2024, 10:22 AMcuddly-engineer-30016
05/10/2024, 10:33 AMbig-architect-71258
05/10/2024, 10:33 AMaugmented provider
. https://github.com/pulumi/pulumi-terraform-bridge/blob/master/docs/new-provider.md#augmenting-a-terraform-provider
For this the Terraform Bridge provides the MuxWith
configuration. Please refer to the documentation for details. https://github.com/pulumi/pulumi-terraform-bridge/tree/master/docs
For an example you can refer to my Pulumi Azure repository https://github.com/pulumi/pulumi-azure/compare/master...tmeckel:pulumi-azure:feat/mux-provider-gocuddly-engineer-30016
05/10/2024, 10:41 AMcuddly-engineer-30016
05/10/2024, 10:42 AMbig-architect-71258
05/10/2024, 10:49 AMcuddly-engineer-30016
05/10/2024, 10:52 AMProviderInfo
of the package like suchcuddly-engineer-30016
05/10/2024, 10:53 AMbig-architect-71258
05/10/2024, 10:55 AMcuddly-engineer-30016
05/10/2024, 10:57 AMbig-architect-71258
05/10/2024, 11:01 AMrfc3339_parse
(1) has been added with the 0.11.0 release. The provider is compiled with this version. So the data source should already be mapped to a Pulumi function. I'll check that on my side, why this is not the case. As I understand you (2) is missing even from the upstream provider. Right?limited-rainbow-51650
05/10/2024, 11:01 AMResources
and Datasources
in a TF provider, since TF 1.8, they also offer Functions
. I dropped this question with the same two people you looped in, but on our corporate Slack since I'm not sure we support bridging functions already.cuddly-engineer-30016
05/10/2024, 11:02 AMAs I understand you (2) is missing even from the upstream provider. Right?yep, if we want to keep 1:1 parity, I can try implementing it updstream first
cuddly-engineer-30016
05/10/2024, 11:04 AMbig-architect-71258
05/10/2024, 11:04 AMmuxWith
or with ExtraFunctions
as a fall back.big-architect-71258
05/10/2024, 11:06 AMMuxWith
. But because I wasn't quite sure about the possible consequences using ExtraFunctions
that's why I looped in Ian and Anton.big-architect-71258
05/10/2024, 11:21 AMFunction
declaration of TF 1.8 for rfc3339_parse
, it's not automatically mapped to the Pulumi provider. Wasn't aware of this new provider resource type in Terraform.
Aside that having the new data source (function) implemented that @cuddly-engineer-30016 is talking about in (2) he can either implement it first in the upstream provider (I think Hashcorp will "force" him to implement the parsing stuff as a Function
as well) or we use `MuxWith`or ExtraFunction
what fits best here.big-architect-71258
05/10/2024, 11:24 AMFunction
from an upstream Terraform provider. @enough-garden-22763 @ancient-policeman-24615big-architect-71258
05/10/2024, 11:32 AMcuddly-engineer-30016
05/10/2024, 11:35 AMPulumi.yaml
but I dont think that's possible, is it? i really don't want to write and maintain a provider for utility functions.cuddly-engineer-30016
05/10/2024, 11:38 AMcuddly-engineer-30016
05/10/2024, 11:47 AMAside that having the new data source (function) implemented that @cuddly-engineer-30016 is talking about in (2) he can either implement it first in the upstream provider (I think Hashcorp will "force" him to implement the parsing stuff as a@big-architect-71258 since TF bridge doesn't have the support now, adding the new unix timestamp parser to terraform doesnt seem too useful. But that too depends on when the bridge has feature to map TF functions. Right now, tbh, I don't have an issue immediately as I only need to convert a RFC timestamp to unix today but I might need to do the other way round in the future so I jumped in here as I saw the gap.as well) or we use `MuxWith`orFunction
what fits best here.ExtraFunction
cuddly-engineer-30016
05/10/2024, 12:09 PMcommand
package to run stuff locally. This should mean that I can write a bas script to convert the time formats and run thatcuddly-engineer-30016
05/10/2024, 12:11 PMbig-architect-71258
05/10/2024, 12:35 PMpulumi convert
to convert your YAML program into a supported programming language of your choice without losing the connection to the state. A conversion is simply another representation of the stack in another language. Perhaps you reached the end of using YAML here in a meaningful way.
If you don't wanna do that you could open a PR in the Pulumi STR provider which is exactly for that purpose: provide YAML programs with additional functions. https://www.pulumi.com/registry/packages/str/
You might add your missing functions there. Like parsing dates and stuff. Perhaps generating UUIDs as well.enough-garden-22763
05/10/2024, 12:59 PMpulumi convert
or perhaps because providers start publishing important functionality in the form of these functions. From the notes I gather one more use case is when targeting Pulumi primarily from YAML having access to these functions is even more important since there's no TypeScript-like escape hatch of just calling the stdlib. Let's perhaps start by filing a feature request in https://github.com/pulumi/pulumi-terraform-bridge about this and start correlating the use cases there, I can work with my team on getting this in the priority queue. If there's interest in contributing this feature that's also wonderful...cuddly-engineer-30016
05/10/2024, 1:15 PMpulumi-time
package and add the features as functions using MuxWith
or ExtraFunction
. The problem lies with how the addition of the features will play with future updates to the pulumi package and if something will break.
3. Contribute to the pulumi-str
package. Its a package by the pulumi folks themselves and as far as I see, they contain some string manipulation functions. In my opinion, time formatting should not be present in string manipulation modules/packages. If the Pulumi folks are ok with adding function to convert the datetime formats from RFC3999 to Unix and vice versa, I am happy to open a PR.
4. Create my own private provider package that contains all the utility functions that I would need. Is this even possible? I know that I can point to a server in pulumi plugin install
but does it work for a private repo?enough-garden-22763
05/10/2024, 1:24 PMenough-garden-22763
05/10/2024, 1:25 PMrfc3999->unix
perhaps could also be accepted as a built-in (https://github.com/pulumi/pulumi-yaml) but custom providers are certainly much more expressive than what can be packed into the stdlib.cuddly-engineer-30016
05/10/2024, 1:49 PMenough-garden-22763
05/10/2024, 2:27 PMenough-garden-22763
05/10/2024, 3:39 PMcuddly-engineer-30016
05/10/2024, 5:25 PMtoBase64
as an examplecuddly-engineer-30016
05/11/2024, 1:31 PMpulumi-std
repo with functions I wanted to add. There are a few things that I feel like could be improved in that repo, just some basic housekeeping stuff, especially if this package is supposed to be public facing. We can discuss them if you want.https://github.com/pulumi/pulumi-std/pull/57