Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Begin Gradual port to go-provider-sdk #258

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

iwahbe
Copy link
Member

@iwahbe iwahbe commented Apr 24, 2024

This PR is designed to enable a gradual transition onto the go provider sdk, starting from core parts of the provider and moving gradually (in future PRs) to leaf parts of the provider.

This PR converts the Provider/Configure resource args to the pulumi-go-provider. It converts all resources to use the new client injection mechanism, but does not change the resource implementation itself. Tests have been updated to reflect the new client injection mechanism.


024d0d5:

This commit uses the infer package to generate the schema. The hand-written schema has
moved to legacy-schema.json. legacy-schem.json is still embedded in the binary, since
the wrapped RPC provider still needs to be able to produce a schema. As resources are
moved over the raw RPC provider to infer, they can be removed from the legacy
schema. While it looks like the new schema.json file checked in with this commit is
extremely different, there are no semantic changes. The only changes are introducing the
module format key, re-ordering "required" and "requiredInputs" and adding the "type": "object", indicator on objects (the default). For completeness, I have included the
entire diff:

$ json-diff original-schema.json schema.json
 {
+  meta: {
+    moduleFormat: "(.*)"
+  }
   types: {
     pulumiservice:index:DeploymentSettingsGitAuthBasicAuth: {
       required: [
+        "password"
         ...
-        "password"
       ]
     }
     pulumiservice:index:GCPOIDCConfiguration: {
       required: [
         ...
-        "workloadPoolId"
         ...
         ...
+        "workloadPoolId"
       ]
     }
     pulumiservice:index:AzureOIDCConfiguration: {
       required: [
         ...
+        "subscriptionId"
         ...
-        "subscriptionId"
       ]
     }
   }
   resources: {
     pulumiservice:index:AgentPool: {
+      type: "object"
     }
     pulumiservice:index:AccessToken: {
+      type: "object"
       required: [
+        "description"
         ...
-        "description"
         ...
       ]
     }
     pulumiservice:index:Team: {
+      type: "object"
       required: [
+        "members"
         ...
         ...
-        "members"
       ]
     }
     pulumiservice:index:TeamAccessToken: {
+      type: "object"
       required: [
         ...
+        "organizationName"
         ...
-        "organizationName"
         ...
       ]
       requiredInputs: [
         ...
+        "organizationName"
         ...
-        "organizationName"
       ]
     }
     pulumiservice:index:OrgAccessToken: {
+      type: "object"
     }
     pulumiservice:index:Webhook: {
+      type: "object"
       required: [
         ...
         ...
+        "format"
+        "name"
         ...
         ...
-        "name"
-        "format"
       ]
     }
     pulumiservice:index:DeploymentSettings: {
+      type: "object"
       requiredInputs: [
         ...
         ...
+        "sourceContext"
         ...
-        "sourceContext"
       ]
     }
     pulumiservice:index:StackTag: {
+      type: "object"
       required: [
+        "name"
         ...
         ...
         ...
-        "name"
         ...
       ]
       requiredInputs: [
+        "name"
         ...
         ...
         ...
-        "name"
         ...
       ]
     }
     pulumiservice:index:TeamStackPermission: {
+      type: "object"
       requiredInputs: [
-        "team"
         ...
+        "permission"
         ...
         ...
-        "permission"
+        "team"
       ]
     }
   }
 }

6b5850f: Change client injection mechanism to use context.Context.

@iwahbe iwahbe self-assigned this Apr 24, 2024
iwahbe added 3 commits April 24, 2024 15:32
This commit uses the infer package to generate the schema. The hand-written schema has
moved to `legacy-schema.json`. `legacy-schem.json` is still embedded in the binary, since
the wrapped RPC provider still needs to be able to produce a schema. As resources are
moved over the raw RPC provider to infer, they can be removed from the legacy
schema. While it looks like the new `schema.json` file checked in with this commit is
extremely different, there are no semantic changes. The only changes are introducing the
module format key, re-ordering `"required"` and `"requiredInputs"` and adding the `"type":
"object",` indicator on objects (the default). For completeness, I have included the
entire diff:

```
$ json-diff original-schema.json schema.json
 {
+  meta: {
+    moduleFormat: "(.*)"
+  }
   types: {
     pulumiservice:index:DeploymentSettingsGitAuthBasicAuth: {
       required: [
+        "password"
         ...
-        "password"
       ]
     }
     pulumiservice:index:GCPOIDCConfiguration: {
       required: [
         ...
-        "workloadPoolId"
         ...
         ...
+        "workloadPoolId"
       ]
     }
     pulumiservice:index:AzureOIDCConfiguration: {
       required: [
         ...
+        "subscriptionId"
         ...
-        "subscriptionId"
       ]
     }
   }
   resources: {
     pulumiservice:index:AgentPool: {
+      type: "object"
     }
     pulumiservice:index:AccessToken: {
+      type: "object"
       required: [
+        "description"
         ...
-        "description"
         ...
       ]
     }
     pulumiservice:index:Team: {
+      type: "object"
       required: [
+        "members"
         ...
         ...
-        "members"
       ]
     }
     pulumiservice:index:TeamAccessToken: {
+      type: "object"
       required: [
         ...
+        "organizationName"
         ...
-        "organizationName"
         ...
       ]
       requiredInputs: [
         ...
+        "organizationName"
         ...
-        "organizationName"
       ]
     }
     pulumiservice:index:OrgAccessToken: {
+      type: "object"
     }
     pulumiservice:index:Webhook: {
+      type: "object"
       required: [
         ...
         ...
+        "format"
+        "name"
         ...
         ...
-        "name"
-        "format"
       ]
     }
     pulumiservice:index:DeploymentSettings: {
+      type: "object"
       requiredInputs: [
         ...
         ...
+        "sourceContext"
         ...
-        "sourceContext"
       ]
     }
     pulumiservice:index:StackTag: {
+      type: "object"
       required: [
+        "name"
         ...
         ...
         ...
-        "name"
         ...
       ]
       requiredInputs: [
+        "name"
         ...
         ...
         ...
-        "name"
         ...
       ]
     }
     pulumiservice:index:TeamStackPermission: {
+      type: "object"
       requiredInputs: [
-        "team"
         ...
+        "permission"
         ...
         ...
-        "permission"
+        "team"
       ]
     }
   }
 }
```
@iwahbe iwahbe force-pushed the iwahbe/port-one-resource-to-infer branch from 863b06b to ea207a6 Compare April 24, 2024 22:35
@iwahbe iwahbe added the impact/no-changelog-required This issue doesn't require a CHANGELOG update label Apr 24, 2024
@iwahbe iwahbe changed the title Gradual port to go-provider-sdk Begin Gradual port to go-provider-sdk Apr 24, 2024
@iwahbe iwahbe force-pushed the iwahbe/port-one-resource-to-infer branch from 712be1d to 0b9e63c Compare April 25, 2024 17:07
@iwahbe
Copy link
Member Author

iwahbe commented Apr 25, 2024

This is a pretty big change, so feel free to open up a sync conversation if you have questions / concerns about merging.

I can decompose into smaller PRs if necessary.

iwahbe added a commit to pulumi/pulumi-go-provider that referenced this pull request Apr 26, 2024
While working on
pulumi/pulumi-pulumiservice#258, I noticed that
native providers receive unknown values over the wire regardless of
configure options. This reflects that in the `rpc` middleware.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact/no-changelog-required This issue doesn't require a CHANGELOG update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant