https://pulumi.com logo
Title
b

big-architect-71258

03/30/2023, 9:04 PM
@enough-garden-22763 I was finally able to generate `tfgen`for the `mssql`Terraform provider!!!!🎉🚀 Many thanks for commiting the Set support for the Terraform Plugin Framework.
Had to disable autonaming (
prov.SetAutonaming(255, "-")
), because it created a SIGSEGV.
Okay, successfully created the initial drop of SDK packages for Typescript/Javascript:meow-party:
e

enough-garden-22763

03/30/2023, 9:46 PM
Well that's progress! Let me tag a new version
b

big-architect-71258

03/30/2023, 9:47 PM
Oh ... Too bad 😉
warning: resource:mssql_azuread_service_principal.Docs received a non-zero custom value &{docs/resources/azuread_service_principal.md []     false} that is being ignored. Plugin Framework based providers do not yet support this feature.
But guys you did a great job with current version of PF!
e

enough-garden-22763

03/30/2023, 9:47 PM
I think I know what's going on with AutoNaming, I'll fix the panic and I now have a ticket to actually make AutoNaming work there's a bit of legwork there
b

big-architect-71258

03/30/2023, 9:47 PM
Yes it's definitely progress!!!
e

enough-garden-22763

03/30/2023, 9:47 PM
Yes I tried to emit Warnings on everything we're not sure we're supporting yet
@ancient-policeman-24615 thank you for set support!
Now I'd be curious if you get to a hello world with this provider working at runtime - that's the ultimate test.. Would love to unblock if you hit any issues on that path.
b

big-architect-71258

03/30/2023, 9:49 PM
Creating the SDK is the first part. Well see what happens when the provider has to to what it's supposed to do 😎 I'll keep you posted!
e

enough-garden-22763

03/30/2023, 9:49 PM
Yep
You can drive it from Pulumi YAML without an SDK even
But SDKs should be fine too - all that is mostly battle tested code, not the new code we're testing
b

big-architect-71258

03/30/2023, 9:50 PM
Oh your're right! That's why YAML was so important for Pulumi!
To use it from YAML the provider must be located in the
$HOME/.pulumi/bin
directory. Right? Or something else?
e

enough-garden-22763

03/30/2023, 9:51 PM
Anywhere in $PATH
b

big-architect-71258

03/30/2023, 9:52 PM
I'll give that a try first then. Now I need some sleep. It's late over here 😂 CU!
@enough-garden-22763 Nice! 🙂
e

enough-garden-22763

03/31/2023, 5:28 PM
Thank you for confirming.
Any luck with runtime use of the provider? Appreciate if you have any updates on that.
b

big-architect-71258

03/31/2023, 5:32 PM
Right now working on it. Setting up a YAML project.
e

enough-garden-22763

03/31/2023, 5:32 PM
Ty!
b

big-architect-71258

03/31/2023, 6:17 PM
Pulumi calls the provider. But I missed setting the version correctly and I saw that I didn't implemented the configuration settings either. But so far no crash!
Any hint where I've to put the semver compatible version in
<http://resources.to|resources.go
of the provider to> satisfy Pulumi about this?
e

enough-garden-22763

03/31/2023, 6:19 PM
ProviderInfo struct has a Version field, if you stick a value in there that should work I think.
b

big-architect-71258

03/31/2023, 6:19 PM
Or is this something that has to be done in the upstream Terraform provider?
Looks much, much better 😄 Didn't work and crashed because of the missing configuration I guess. I'll have to work this out.
I already realized that the provider isn't programmed will full proof in mind :-D
e

enough-garden-22763

03/31/2023, 6:25 PM
Ah interesting! Well this looks great, progress indeed
b

big-architect-71258

03/31/2023, 6:26 PM
Yes! But I call it a day. Have a nice weekend. If I find some time I'll work on this on Sunday. I'll keep you posted for sure.
Oh, one last question. How do I specify Provider options, when I create them explicitly like so
provider:
    type: pulumi:providers:azure
    options:
      version: 5.38.0

  provider-mssql:
    type: pulumi:providers:mssql
I mean configuration options, not this "Pulumi" options field 🙂
There is a very thin documentation around this. But unfortunately nothing about setting the provider configuration https://www.pulumi.com/docs/reference/yaml/#explicit-provider
In Typescript I'd simply pass them as parameters. No clue how to do this in YAML.
e

enough-garden-22763

03/31/2023, 7:14 PM
Ah interesting I don't remember off the top of my head, I'll pass this to the docs team.
I'm guessing
provider
has
properties:
subfield but nothing beats a good example.
We also have https://github.com/pulumi/pulumi-lsp but I don't have it handy to try out
a

ancient-policeman-24615

03/31/2023, 7:15 PM
Provider options for explicit providers are just passed as resource properties on the provider resource
e

enough-garden-22763

03/31/2023, 7:15 PM
Can you write a squick yntax example?
Realize this is a chatgpt kind of question, need to get a licence
a

ancient-policeman-24615

03/31/2023, 7:16 PM
name: example
runtime: yaml
config:
  region: us-east-1
resources:
  aws:
    type: pulumi:providers:aws
    properties:
      region: ${region}
  bucket:
    type: aws:s3:Bucket
    options:
      provider: ${aws}
b

big-architect-71258

03/31/2023, 7:19 PM
@ancient-policeman-24615 many thanks. Looks good 👍🏼 If I've time I'll add a PR to the docs repo to have this approach documented.
@enough-garden-22763 The MSSQL provider is working! 🎉:meow-party:🚀Of course, there is still work to be done to create a real release. I also need to submit some PRs to the Terraform provider. At the moment I am working with a customized version.
e

enough-garden-22763

04/03/2023, 1:31 PM
Excellent news!
b

big-architect-71258

04/03/2023, 3:40 PM
Yes, even better. Right now no need for me to submit any PRs to the upstream provider because they already upgraded the provider to use version 1.1.1 of the Terraform Plugin Framework. One question though: I want to ensure that at least the hostname of the SQL server is set, when the provider is called or created by Pulumi as a resource. I know there is the
PreConfigureCallback
, but when is this function called? Only on a
pulumi up
or as well on
pulumi pre
? I only got to fail a `pulumi pre`when I mark the `hostname`configuration property as
required
using
MarkAsOptional: tfbridge.False()
. The
PreConfigureCallback
seems not to be called on a
preview
. Do I miss something?
e

enough-garden-22763

04/03/2023, 5:11 PM
Is that not a required property? If you make it required it should enforce being set I think?
PreConfigureCallback is not supported yet but backlogged, you can upvote that if you really need it
(that helps prioritize)
it's a small thing to support but we've got a fair bit of priorities 😓 PRs are welcome too
Is your code something that is possible to publish say at https://github.com/pulumiverse/pulumi-mssql ?
b

big-architect-71258

04/05/2023, 1:44 PM
Yes, I could publish a pre-alpha? But something not really I wanna publish. Like to run some more tests. And perhaps wait for a some details that are currently not implemented in PF TF Bridge
e

enough-garden-22763

04/05/2023, 2:09 PM
Perhaps on a branch?
I'd just love to have a look myself as well as point people internally at Pulumi to a success story, even if it's early 🙂
D'you know which PF TF bridge features block you that's super helpful for me also to prioritize
b

big-architect-71258

04/05/2023, 2:12 PM
For the PF TF bridge features (screenshot) and you in addition currently can't override the path to the doc files. Not things that are real blockers.
Let me ensure that the code compiles on an empty system so that I can be sure that everybody is able to run
make provider
. I'll like to add some YAML example code as well.
e

enough-garden-22763

04/05/2023, 2:14 PM
Yeah very nice. SO the the default one is this one https://github.com/pulumi/pulumi-terraform-bridge/issues/938
I had a hunch we'll need that soon but nice to have confirmation
can't override the path to the doc files.
This one I'm not sure I'm tracking would love to understand that better, care to expand a little bit?
b

big-architect-71258

04/05/2023, 2:27 PM
If the doc files are not setup like expected by TF Bridge you can override the path to a MD file for a resource or data source by setting the
Docs
property of the
tfbridge.ResourceInfo
struct.
I gave 938 a thumbs up
e

enough-garden-22763

04/05/2023, 2:44 PM
Got it, noting
b

big-architect-71258

04/05/2023, 3:23 PM
I didn't create the SDKs yet. I don't like a noisy branch 😄
You can find an example in the `example/yaml`folder
e

enough-garden-22763

04/05/2023, 3:29 PM
Huh, touche. Nice.
Yeah I sometimes wonder why we check in generated SDKs, the amount of pain in managing Git Repos is formidable as we take this off the beaten path and are fighting the tooling.
However there is an advantage I guess that code scanning tools can consume the generated content.
Also for existing Pulumi providers we can't move the Go files because user programs link against them.. So we're a bit locked into this approach of having to generate SDKs
We had some early conversations about some kind of system that publishes all the language SDKs for you, well for Go this would mean this system likely will need to manage "sidecar" GitHub repositories for the Go SDKs
b

big-architect-71258

04/05/2023, 3:31 PM
I definitly understand why the SDKs have to be published and versioned inside the provider's Git repo. But during that initial development phase when you start to wrap a new TF provider this really clutters up you commits, when you keep constantly create the SDKs.
Oh no, please no deviations especially with Go SDK (module) stuff.
e

enough-garden-22763

04/05/2023, 3:34 PM
Noted 🙂
Well there's possibility to ease some of the pain with tooling, even if the SDKs stay in the same repo layout. Like GHA that auto-regenerates them. Or excluding them from being visible in GitHub diffs.
b

big-architect-71258

04/05/2023, 3:37 PM
The only way to exclude diff from Git is to use
.gitignore
but how you'll make sure they get updated on a new release. Well perhaps with a GitHub Workflow step or something automated.
e

enough-garden-22763

04/05/2023, 5:56 PM
That's true. There was some GitHub specific feature that configures their diff viewer, but it's niche.
Yeah GitHub Workflow step would be more foolproof.
b

big-architect-71258

04/07/2023, 2:34 PM
When I try to build the go SDK for the MSSQL provider the following error (warning) is generated.
warning: unable to convert HCL example for Pulumi entity '#/functions/mssql:index/getSchemas:getSchemas': 1 error occurred:
        * failed to convert HCL for #/functions/mssql:index/getSchemas:getSchemas to go: invalid Go source code:

package main

import (

"<http://github.com/pulumi/pulumi/sdk/v3/go/pulumi|github.com/pulumi/pulumi/sdk/v3/go/pulumi>"
"<http://github.com/pulumi/pulumi-mssql/sdk/go/mssql|github.com/pulumi/pulumi-mssql/sdk/go/mssql>"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := mssql.LookupDatabase(ctx, &mssql.LookupDatabaseArgs{
Name: "example",
}, nil);
if err != nil {
return err
}
all, err := mssql.GetSchemas(ctx, &mssql.GetSchemasArgs{
DatabaseId: pulumi.StringRef(example.Id),
}, nil);
if err != nil {
return err
}
ctx.Export("allSchemaNames", %!!(MISSING)v(PANIC=Format method: fatal: A failure has occurred: unlowered splat expression @ #-functions-mssql:index-getSchemas:getSchemas.pp:7,11-30))
return nil
})
}
: 22:30: expected operand, found '%!'(MISSING) (and 5 more errors)
Is this related to the PF support in TF bridge?
e

enough-garden-22763

04/07/2023, 2:45 PM
Ugh, no but I think it's a Pulumi bug related to documentation examples rendering
b

big-architect-71258

04/07/2023, 2:57 PM
Python has a similar problem:
warning: unable to convert HCL example for Pulumi entity '#/functions/mssql:index/getQuery:getQuery': 1 error occurred:
        * :0,0-0: cannot iterate over a value of type union(list(map(string)), none);
e

enough-garden-22763

04/07/2023, 2:57 PM
Yeah.
We've got a fair bit of tehse
This bit of the product is not quite on par with some of the other bits
I can say there's some work done on this but I'm sorry it still affects your build
You can mostly safely ignore
What happens it that an example is ignored from documentation strings in the generated code.
Because the rendering pipeline fails to cross-compile it from HCL to say Python
Safely as in - it's unfortunate but it does not affect runtime behavior of the provider or Python SDK
b

big-architect-71258

04/07/2023, 3:00 PM
Yes I know that I can mostly ignore those issues around documentation and examples. But nevertheless it's a good thing that the folks at MSSQL Provider are using all of Terraform's new features.