diff --git a/CHANGELOG.md b/CHANGELOG.md index fd0170f159..c1472e02a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## HEAD (Unreleased) - Ensure using `PULUMI_KUBERNETES_MANAGED_BY_LABEL` doesn't cause diffs on further stack updates (https://github.com/pulumi/pulumi-kubernetes/pull/1508) +- [sdk/ts] Update CustomResource to match current codegen (https://github.com/pulumi/pulumi-kubernetes/pull/1510) ## 2.8.3 (March 17, 2021) diff --git a/provider/pkg/gen/nodejs-templates/apiextensions/customResource.ts b/provider/pkg/gen/nodejs-templates/apiextensions/customResource.ts index 663a1ed198..f06aa480d5 100755 --- a/provider/pkg/gen/nodejs-templates/apiextensions/customResource.ts +++ b/provider/pkg/gen/nodejs-templates/apiextensions/customResource.ts @@ -18,7 +18,7 @@ import * as pulumi from "@pulumi/pulumi" import * as inputs from "../types/input"; import * as outputs from "../types/output"; -import { getVersion } from "../utilities"; +import * as utilities from "../utilities"; /** * CustomResource represents an instance of a CustomResourceDefinition (CRD). For example, the @@ -74,18 +74,21 @@ export class CustomResource extends pulumi.CustomResource { * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: CustomResourceArgs, opts?: pulumi.CustomResourceOptions) { - const props: pulumi.Inputs = {}; - for (const key of Object.keys(args)) { - props[key] = (args as any)[key]; - } - - if (!opts) { - opts = {} + let inputs: pulumi.Inputs = {}; + opts = opts || {}; + if (!opts.id) { + for (const key of Object.keys(args)) { + inputs[key] = (args as any)[key]; + } + } else { + for (const key of Object.keys(args)) { + inputs[key] = undefined; + } } if (!opts.version) { - opts.version = getVersion(); + opts = pulumi.mergeOptions(opts, { version: utilities.getVersion()}); } - super(`kubernetes:${args.apiVersion}:${args.kind}`, name, props, opts); + super(`kubernetes:${args.apiVersion}:${args.kind}`, name, inputs, opts); this.__inputs = args; } } diff --git a/sdk/nodejs/apiextensions/customResource.ts b/sdk/nodejs/apiextensions/customResource.ts index 663a1ed198..f06aa480d5 100644 --- a/sdk/nodejs/apiextensions/customResource.ts +++ b/sdk/nodejs/apiextensions/customResource.ts @@ -18,7 +18,7 @@ import * as pulumi from "@pulumi/pulumi" import * as inputs from "../types/input"; import * as outputs from "../types/output"; -import { getVersion } from "../utilities"; +import * as utilities from "../utilities"; /** * CustomResource represents an instance of a CustomResourceDefinition (CRD). For example, the @@ -74,18 +74,21 @@ export class CustomResource extends pulumi.CustomResource { * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: CustomResourceArgs, opts?: pulumi.CustomResourceOptions) { - const props: pulumi.Inputs = {}; - for (const key of Object.keys(args)) { - props[key] = (args as any)[key]; - } - - if (!opts) { - opts = {} + let inputs: pulumi.Inputs = {}; + opts = opts || {}; + if (!opts.id) { + for (const key of Object.keys(args)) { + inputs[key] = (args as any)[key]; + } + } else { + for (const key of Object.keys(args)) { + inputs[key] = undefined; + } } if (!opts.version) { - opts.version = getVersion(); + opts = pulumi.mergeOptions(opts, { version: utilities.getVersion()}); } - super(`kubernetes:${args.apiVersion}:${args.kind}`, name, props, opts); + super(`kubernetes:${args.apiVersion}:${args.kind}`, name, inputs, opts); this.__inputs = args; } }