You can always ask questions here we tend to keep ...
# general
t
You can always ask questions here we tend to keep an eye out. Right how the most straightforward way to implement a provider is documented and is mainly going to be in go lang
If it's easier you can always consider dynamic providers or if you're more familiar you can even use tf providers with Pulumi if you want to go that route and it makes sense for you and your organization (but of course a native provider is ideal and will have more benefits)
p
Thanks @thankful-flower-8175 We are almost done with the pulumi provider implementation and working on ci-cd to publish sdks and resource providers to pulumi registry. Node sdk is falling to publish on npm registry because we are using the
@pulumi
scope.
But as mentioned by @little-cartoon-10569 We can use our own namespace instead of pulumi for node sdk.
e
Yup checkout how pulumiverse repos do this, and we've got some work in progress to make this easier (https://github.com/pulumi/pulumi/pull/18720)
p
@echoing-dinner-19531 I am trying to change schema.json with, This should work and use
duplocloud
npm namespace
Copy code
"nodejs": {
            "packageName": "@duplocloud/pulumi",
            "packageDescription": "A Pulumi package for creating and managing duplocloud cloud resources.",
            "readme": "\u003e This provider is a derived work of the [Terraform Provider](<https://github.com/duplocloud/terraform-provider-duplocloud>)\n\u003e distributed under [MPL 2.0](<https://www.mozilla.org/en-US/MPL/2.0/>). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-duplocloud` repo](<https://github.com/duplocloud/pulumi-duplocloud/issues>); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-duplocloud` repo](<https://github.com/duplocloud/terraform-provider-duplocloud/issues>).",
            "compatibility": "tfbridge20",
            "disableUnionOutputTypes": true,
            "respectSchemaVersion": true
        },
If we dnt provide
packageName": "@duplocloud/pulumi"
pulumi genrator is using
@pulumi
namespace for sdk
e
Yes, that's the recommendation for now. Hopefully we'll have a release soon where you can just put
"namespace": "duplocloud"
as a top level key of schema.json to get the same effect for all languages.
p
Great 👍
@echoing-dinner-19531 I am regenerating the node sdk using
make build_sdks
after changes in
schema.json
but it's not generating because the node SDK is already present under
sdk
Its throwing
Copy code
tahirtamboli@Tahirs-MacBook-Pro pulumi-duplocloud % make build_sdks      
make: Nothing to be done for `build_sdks'.
@echoing-dinner-19531 It's still generating node sdk with following
package.json
Copy code
{
  "name": "@pulumi/duplocloud",
  "version": "1.0.0-alpha.0+dev",
  "description": "A Pulumi package for creating and managing duplocloud cloud resources.",
  "keywords": [
    "duplocloud",
    "category/cloud"
  ],
  "homepage": "<https://www.pulumi.com>",
  "repository": "<https://github.com/duplocloud/pulumi-duplocloud>",
  "license": "Apache-2.0",
  "scripts": {
    "build": "tsc"
  },
  "dependencies": {
    "@pulumi/pulumi": "^3.142.0"
  },
  "devDependencies": {
    "@types/node": "^14",
    "typescript": "^4.3.5"
  },
  "pulumi": {
    "resource": true,
    "name": "duplocloud",
    "version": "1.0.0-alpha.0+dev"
  }
}
schema.json
Copy code
"language": {
        "csharp": {
            "packageReferences": {
                "Pulumi": "3.*"
            },
            "compatibility": "tfbridge20",
            "respectSchemaVersion": true
        },
        "go": {
            "importBasePath": "<http://github.com/duplocloud/pulumi-duplocloud/sdk/go/duplocloud|github.com/duplocloud/pulumi-duplocloud/sdk/go/duplocloud>",
            "generateResourceContainerTypes": true,
            "generateExtraInputTypes": true,
            "respectSchemaVersion": true
        },
        "nodejs": {
            "packageName": "@duplocloud/pulumi",
            "packageDescription": "A Pulumi package for creating and managing duplocloud cloud resources.",
            "readme": "\u003e This provider is a derived work of the [Terraform Provider](<https://github.com/duplocloud/terraform-provider-duplocloud>)\n\u003e distributed under [MPL 2.0](<https://www.mozilla.org/en-US/MPL/2.0/>). If you encounter a bug or missing feature,\n\u003e first check the [`pulumi-duplocloud` repo](<https://github.com/duplocloud/pulumi-duplocloud/issues>); however, if that doesn't turn up anything,\n\u003e please consult the source [`terraform-provider-duplocloud` repo](<https://github.com/duplocloud/terraform-provider-duplocloud/issues>).",
            "compatibility": "tfbridge20",
            "disableUnionOutputTypes": true,
            "respectSchemaVersion": true
e
Just delete the sdk folder and rerun? The makesfiles don't really do dependency tracking like good makefiles would do
p
@echoing-dinner-19531 I deleted the sdk folder, but it's still generating node sdk with
@pulumi/duplocloud
@echoing-dinner-19531 After adding
@duplocloud/pulumi
in
resource.go
it is generating the right package name in package.json.
Copy code
JavaScript: &tfbridge.JavaScriptInfo{
			// RespectSchemaVersion ensures the SDK is generated linking to the correct version of the provider.
			RespectSchemaVersion: true,
			PackageName:          "@duplocloud/pulumi",
		},
@echoing-dinner-19531 If I generate sdks using
make clean && make build_sdks
its generating docs back to
@pulumi/duplocloud
e
Suggest raising a bug, someone can hopefully take a look next week
p
@echoing-dinner-19531 Should i raise bug here - https://github.com/pulumi/pulumi-tf-provider-boilerplate/
e
yes
p
@echoing-dinner-19531 Bug has been there for a long time - https://github.com/pulumi/pulumi/issues/15979, Is it possible to use the pulumi namesapce for node SDK? We are blocked here from publishing our pulumi provider. Can you please help here.
So that we can use
@pulumi/duplocloud
name for node sdk.
e
Had a quick look at that. I think it's an issue in the terraform bridge, so hasn't had the right team looking into it. I've moved it now, hopefully can be looked at next week.
p
Thank you so much @echoing-dinner-19531 🙏
e
Looks like if you set the envvar PULUMI_CONVERT=1 then it converts correctly: https://github.com/pulumi/pulumi-terraform-bridge/issues/2923#issuecomment-2694201476
p
Thanks @echoing-dinner-19531 will check and let you know 👍🏻
@echoing-dinner-19531 It's still generating
import * as duplocloud from "@pulumi/duplocloud";
for a few files
Copy code
* ```typescript
  * import * as pulumi from "@pulumi/pulumi";
  * import * as duplocloud from "@duplocloud/pulumi";
+ * import * as duplocloud from "@pulumi/duplocloud";
  *
  * // Before creating the EKS worker node, you must first set up the infrastructure with EKS cluster enabled and a tenant. Below is the resource for creating the infrastructure.
  * const infra = new duplocloud.Infrastructure("infra", {
  *     infraName: "dev",
  *     cloud: 0,
e
Suggest commenting on that issue, someone on the tfbridge team can probably help better than me.
p
Yes commented on issue.
@echoing-dinner-19531 I can use unscoped node package instead of scoped, right? There is no restriction from pulumi to use scoped node SDK.
e
I think that should be fine, but the codegen might struggle in the same way for examples.
p
@echoing-dinner-19531 If I want to publish a scoped public node SDK, can I specify somewhere? Because we generally publish like
npm publish --access public
But I don't see it in pulumi
pulumi package publish-sdk nodejs
command https://github.com/pulumi/pulumi-package-publisher/blob/main/lang/nodejs/action.yml#L40
I am facing the following issue while publishing node packeg
@duplocloud/pulumi
, and I think Pulumi is publishing packages as scoped private by default.
Copy code
npm notice Publishing to <https://registry.npmjs.org/> with tag dev and default access
npm error code E402
npm error 402 Payment Required - PUT <https://registry.npmjs.org/@duplocloud%2fpulumi> - You must sign up for private packages
npm error A complete log of this run can be found in: /home/runner/.npm/_logs/2025-03-02T06_34_20_735Z-debug-0.log
npm error code E404
npm error 404 Not Found - GET <https://registry.npmjs.org/@duplocloud%2fpulumi> - Not found
npm error 404
npm error 404  '@duplocloud/pulumi@0.1.0-alpha.1740896843' is not in this registry.
npm error 404
npm error 404 Note that you can also install from a
npm error 404 tarball, folder, http url, or git url.
npm error A complete log of this run can be found in: /home/runner/.npm/_logs/2025-03-02T06_34_22_155Z-debug-0.log
@echoing-dinner-19531 Can you please help here whenever you get time, It's a major blocker for now.
e
pulumi package publish-sdk is a pretty thin wrapper around npm publish, might be easiest to just replace that command in the makefile
p
Let me try this