Hi, I upgrade each month our provider in order to sync with our terraform provider Today I wanted to...
a

Aurelie Vache

9 months ago
Hi, I upgrade each month our provider in order to sync with our terraform provider Today I wanted to upgrade it without success
# upgrade-provider ovh/pulumi-ovh
...
--- Plan Upgrade --- 
  - Planning Bridge Upgrade: v3.99.0 -> v3.101.0
    - git refs of
      - git: /usr/bin/git ls-remote --tags <https://github.com/pulumi/pulumi-terraform-bridge.git>
  - Planning Plugin SDK Upgrade: bridge v3.101.0 needs terraform-plugin-sdk v2.0.0-20240520223432-0c0bf0d65f10
  - Check if we should release a maintenance patch: Last provider release date: 2025-01-06T13:28:57Z
    - gh: /usr/bin/gh repo view ovh/pulumi-ovh --json=latestRelease
  - Planning Plugin Framework Upgrade: Up to date at 0.49.0
    - git refs of
      - git: /usr/bin/git ls-remote --tags <https://github.com/pulumi/pulumi-terraform-bridge>
--- done ---
--- Planning Java Gen Version Update --- 
  - Fetching latest Java Gen
    - Latest Release Version: of pulumi/pulumi-java: 1.0.0
      - gh: /usr/bin/gh repo view pulumi/pulumi-java --json=latestRelease
    - Stat
    - .pulumi-java-gen.version: 5 bytes read
    - Up to date at: 1.0.0
--- done ---
...
--- Tfgen & Build SDKs --- 
  - go: /usr/local/go/bin/go mod tidy
  - go: /usr/local/go/bin/go mod tidy
  - go: /usr/local/go/bin/go mod tidy
 -> make: /usr/bin/make tfgen
--- failed ---
error: exit status 2:
# <http://github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema|github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema>
/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20240520223432-0c0bf0d65f10/helper/schema/grpc_provider.go:33:34: cannot use (*GRPCProviderServer)(nil) (value of type *GRPCProviderServer) as tfprotov5.ProviderServer value in variable declaration: *GRPCProviderServer does not implement tfprotov5.ProviderServer (missing method CloseEphemeralResource)
/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20240520223432-0c0bf0d65f10/helper/schema/provider.go:526:9: cannot use NewGRPCProviderServer(p) (value of type *GRPCProviderServer) as tfprotov5.ProviderServer value in return statement: *GRPCProviderServer does not implement tfprotov5.ProviderServer (missing method CloseEphemeralResource)
make: *** [Makefile:67: tfgen] Error 1
Do you know how to solve this blocking issue? Thanks
I'm trying to build a dynamic resource + provider. The lifecycle of the resource itself works just ...
g

Gerrit Begher

9 months ago
I'm trying to build a dynamic resource + provider. The lifecycle of the resource itself works just fine - (at least as far as I've implemented it): The respective objects get created/updated in my AWS account. However what I'm having trouble is making the inputs/outputs available on the resource object within my pulumi program:
// USAGE EXAMPLE
  const childModel = new AssetModel("test-child-1", {
    name: "some-child-model",
    description: "some-child-model",
    externalId: "some-child-model",
  })

  const assetModel = new AssetModel("test-1", {
    name: "some-asset-model",
    description: "some-asset-model",
    externalId: "some-asset-model",
    properties: [
      {
        name: "prop-2",
        externalId: "SAM-prop-1",
        dataType: PropertyDataType.DOUBLE,
        unit: "someNewUnit",
      },
    ],
    children: [
      {
        name: "asset-model-child",
        externalId: "asset-model-child",
        // !!! The next line is what causes the failure: `childModel.externalId` is `undefined` when pulumi runs the program
        modelId: childModel.externalId.apply(externalId),
      },
    ],
  })
And here's the implementation my resource + provider (some implementation details omitted):
export interface AssetModelProviderArgs {
  /** The name of the asset model */
  name: string
  /** An external id to reference this asset model */
  externalId: string
  /** The description of the asset model */
  description: string
  /** The properties of the asset model */
  properties?: AssetModelProperty[]
  /** The child asset model associations of the asset model */
  children?: AssetModelChild[]
}

export interface AssetModelProperty {
  /** The name of the asset model property */
  name: string
  /** An external id to reference this asset model property */
  externalId: string
  /** The data type of the asset model property */
  dataType: PropertyDataType
  /** The unit of the asset model property */
  unit?: string
}

export interface AssetModelChild {
  /** The name of the child asset model association */
  name: string
  /** An external id to reference this child asset model association */
  externalId: string
  /** The external id of the child asset model */
  modelId: SitewiseId
}

export interface AssetModelProviderOuts extends AssetModelProviderArgs {
  arn: string
}

const readAssetModelOuts = async (
  id: string,
): Promise<AssetModelProviderOuts | undefined> => {
  let readResponse: DescribeAssetModelResponse | null = null
  try {
    readResponse = await getSitewiseClient().assetModel.read({
      assetModelId: id,
    })
  } catch (error) {
    if (error instanceof AxiosError && error.response?.status === 404) {
      return undefined
    }

    throw error
  }

  const assetModel: AssetModelProviderArgs = {
    name: readResponse.assetModelName!,
    externalId: readResponse.assetModelExternalId!,
    description: readResponse.assetModelDescription!,
    properties: (readResponse.assetModelProperties ?? []).map((property) => ({
      name: property.name!,
      externalId: property.externalId!,
      dataType: property.dataType!,
      unit: property.unit,
    })),
    children: (readResponse.assetModelHierarchies ?? []).map((hierarchy) => ({
      name: hierarchy.name!,
      externalId: hierarchy.externalId!,
      modelId: uuid(hierarchy.childAssetModelId!),
    })),
  }

  return {
    ...assetModel,
    arn: readResponse.assetModelArn!,
  }
}

export interface AssetModelArgs {
  name: Input<string>
  description: Input<string>
  externalId: Input<string>
  properties?: Input<AssetModelProviderArgs["properties"]>
  children?: AsInput<AssetModelChild>[]
}

export const assetModelProvider: dynamic.ResourceProvider<
  AssetModelProviderArgs,
  AssetModelProviderOuts
> = {
  async create(args) {
    // ... details omitted

    return {
      id,
      outs: await readAssetModelOuts(id),
    }
  },
  async read(id, outs) {
    return {
      id,
      props: outs ? await readAssetModelOuts(id) : undefined,
    }
  },
  async diff(_, oldOuts, newArgs) {
    // ... details omitted

    return {
      changes: !deepEqual(relevantOuts, relevantArgs),
      stables: ["id", "arn", "externalId"],
    }
  },
  async update(id, _, newArgs) {
    // ... details omitted

    return {
      outs: await readAssetModelOuts(id),
    }
  },
  async delete(id) {
    // Note: This is not sufficient to delete models that contribute to a property formula in a parent.
    await getSitewiseClient().assetModel.delete({ assetModelId: id })
  },
}

export class AssetModel extends dynamic.Resource {
  // args
  public readonly name!: Output<AssetModelProviderOuts["name"]>
  public readonly description!: Output<AssetModelProviderOuts["description"]>
  public readonly externalId!: Output<AssetModelProviderOuts["externalId"]>
  // outs
  public readonly arn!: Output<AssetModelProviderOuts["arn"]>

  constructor(
    name: string,
    args: AssetModelArgs,
    opts?: CustomResourceOptions,
  ) {
    super(assetModelProvider, `xxx:asset-model:${name}`, args, opts)
  }
}
What's the issue here? (I have checked the pulumi state JSON file and the
externalId
for the child model is set at some point.)
Hi everyone, I'm getting strange errors with `pulumi-language-python-exec` when I try to use the `he...
m

Marcelo Barbosa

over 1 year ago
Hi everyone, I'm getting strange errors with
pulumi-language-python-exec
when I try to use the
helm.v4.Chart
package, however, it doesn't refer to the Kubernetes provider because it's not failing on
core.v1.Namespace
, any help is welcome!
Diagnostics:
  pulumi:pulumi:Stack (iac-aws-dev-green-second):
    error: Program failed with an unhandled exception:
    Traceback (most recent call last):
      File "/opt/homebrew/bin/pulumi-language-python-exec", line 192, in <module>
        loop.run_until_complete(coro)
      File "/opt/homebrew/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
        return future.result()
               ^^^^^^^^^^^^^^^
      File "/Users/marcelobarbosa/Documents/work/iac/venv/lib/python3.12/site-packages/pulumi/runtime/stack.py", line 138, in run_in_stack
        await run_pulumi_func(run)
      File "/Users/marcelobarbosa/Documents/work/iac/venv/lib/python3.12/site-packages/pulumi/runtime/stack.py", line 52, in run_pulumi_func
        await wait_for_rpcs()
      File "/Users/marcelobarbosa/Documents/work/iac/venv/lib/python3.12/site-packages/pulumi/runtime/stack.py", line 85, in wait_for_rpcs
        raise exn from cause
      File "/Users/marcelobarbosa/Documents/work/iac/venv/lib/python3.12/site-packages/pulumi/runtime/rpc_manager.py", line 71, in rpc_wrapper
        result = await rpc
                 ^^^^^^^^^
      File "/Users/marcelobarbosa/Documents/work/iac/venv/lib/python3.12/site-packages/pulumi/runtime/resource.py", line 1015, in do_register
        resp = await asyncio.get_event_loop().run_in_executor(None, do_rpc_call)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/opt/homebrew/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/concurrent/futures/thread.py", line 58, in run
        result = self.fn(*self.args, **self.kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/marcelobarbosa/Documents/work/iac/venv/lib/python3.12/site-packages/pulumi/runtime/resource.py", line 1012, in do_rpc_call
        handle_grpc_error(exn)
      File "/Users/marcelobarbosa/Documents/work/iac/venv/lib/python3.12/site-packages/pulumi/runtime/settings.py", line 307, in handle_grpc_error
        raise grpc_error_to_exception(exn)
    Exception: configured Kubernetes cluster is unreachable: unable to load schema information from the API server: the server has asked for the client to provide credentials