I see a weird issue, it seems that we can't instan...
# dotnet
b
I see a weird issue, it seems that we can't instantiate 2 providers within the same stack? I get the error:
Copy code
Diagnostics:
  pulumi:providers:lxd (lxd-provider):
    error: parameterize response name "juju" does not match expected package "lxd"
The code is:
Copy code
var jujuProvider = new Juju.Provider("juju-provider", new Juju.ProviderArgs
            {
                ControllerAddresses = jujuConfig.ControllerEndpoint,
                CaCertificate = jujuConfig.CaCertificate,
                Username = jujuConfig.Username,
                Password = jujuConfig.Password,
            });

var lxdProvider = new Lxd.Provider("lxd-provider", new Lxd.ProviderArgs
        {
            AcceptRemoteCertificate = true,
            GenerateClientCertificates = true,
            ConfigDir = lxcConfigurationDirectory,
            Remotes =
            {
                new Lxd.Inputs.ProviderRemoteArgs
                {
                    Name = lxd.RemoteName, Address = lxd.Address, Default = true
                    //Token = lxd.TrustToken
                }
            }
        });
If I change the order of these 2 instantiations, in the error message "lxd" comes and "juju" would be the second. Both of these providers are generated sdk code from their terraform providers. My config:
Copy code
packages:
  lxd:
    source: terraform-provider
    version: 0.12.0
    parameters:
      - terraform-lxd/lxd
      - 2.5.0
  juju:
    source: terraform-provider
    version: 0.12.0
    parameters:
      - juju/juju
      - 0.20.0
When turned on provider debugging I see only 1
RegisterPackage
call in the logs:
Copy code
{
  "method": "/pulumirpc.ResourceMonitor/RegisterPackage",
  "request": {
    "name": "terraform-provider",
    "version": "0.12.0",
    "parameterization": {
      "name": "lxd",
      "version": "2.5.0",
      "value": "eyJyZW1vdGUiOnsidXJsIjoicmVnaXN0cnkub3BlbnRvZnUub3JnL3RlcnJhZm9ybS1seGQvbHhkIiwidmVyc2lvbiI6IjIuNS4wIn19"
    }
  },
  "response": {
    "ref": "fab2f8f4-58a2-41ec-8495-7fff6329385e"
  },
  "metadata": {
    "mode": "server"
  }
}
And the actual failure is also visible in the logs:
Copy code
{
    "method": "/pulumirpc.ResourceProvider/Parameterize",
    "request": {
        "value": {
            "name": "lxd",
            "version": "2.5.0",
            "value": "eyJyZW1vdGUiOnsidXJsIjoicmVnaXN0cnkub3BlbnRvZnUub3JnL3RlcnJhZm9ybS1seGQvbHhkIiwidmVyc2lvbiI6IjIuNS4wIn19"
        }
    },
    "response": {
        "name": "lxd",
        "version": "2.5.0"
    },
    "metadata": {
        "kind": "resource",
        "mode": "client",
        "name": "terraform-provider"
    }
}
{
    "method": "/pulumirpc.ResourceProvider/Parameterize",
    "request": {
        "value": {
            "name": "juju",
            "version": "2.5.0",
            "value": "eyJyZW1vdGUiOnsidXJsIjoicmVnaXN0cnkub3BlbnRvZnUub3JnL3RlcnJhZm9ybS1seGQvbHhkIiwidmVyc2lvbiI6IjIuNS4wIn19"
        }
    },
    "response": {
        "name": "lxd",
        "version": "2.5.0"
    },
    "metadata": {
        "kind": "resource",
        "mode": "client",
        "name": "terraform-provider"
    }
}
Based on the findings I had an idea if probably the key used to differentiate packages from the config is using source+version, so I updated my config to reference 2 different version of the terraform provider and after a pulumi install and new sdk generation it all worked:
Copy code
packages:
  lxd:
    source: terraform-provider
    version: 0.12.0
    parameters:
      - terraform-lxd/lxd
      - 2.5.0
  juju:
    source: terraform-provider
    version: 0.13.0    <- Notice this change
    parameters:
      - juju/juju
      - 0.20.0
What can be the issue? At this point this is a bug here: https://github.com/pulumi/pulumi-dotnet/blob/44ca9a522cef9ec62efedf5d53805077dea6e434/sdk/Pulumi/Deployment/Deployment_Prepare.cs#L432 IMHO the source+version+parameters.provider+parameters.version should all be part of the key for packages
e
Pretty sure there's an issue for this already, its definitely been reported internally. Just haven't had anyone able to get around to fixing it yet.
1
b
Sorry I did not find it, based on it's description it was not clear if the underlying issue is the same or not, checked other SDKs and it seems that only the .NET SDK has additional code before invoking the RegisterPackage via GRPC. For now we are unblocked by using different version of the terraform-provider, hopefully it will be fixed. Thx
e
It's all parameterisation under the hood so pretty sure its the same issue, I'm getting a test added to the main repo for this today so can see about quickly fixing it next week.
b
Sounds good, thank you. Perhaps there is an underlying issue as well (looking at the PR), but based on my findings I think then it is an additional issue in the .NET SDK, but we'll see!
e
yeh def an issue in the .net SDK the design for parameterisation is different in dotnet compared to all the other SDKs
👍 1