Skip to content

unknown provider exception from terraformConfig() #658

@t0yv0

Description

@t0yv0

Describe what happened

Getting an error when calling the terraformConfig method to extract a TF-formatted provider configuration:

   error: Running program '/Users/anton/tmp/2025-06-24/dotnet-blog-examples/bin/Debug/net8.0/dotnet-blog-examples.dll' failed with an unhandled exception:
    Grpc.Core.RpcException: Status(StatusCode="Unknown", Detail="unknown provider 'urn:pulumi:dev::dotnet-blog-examples::pulumi:providers:aws::aws-provider::' -> 'urn:pulumi:dev::dotnet-blog-examples::pulumi:providers:aws::aws-provider::'")
       at async Task<CallResponse> Pulumi.GrpcMonitor.CallAsync(ResourceCallRequest request)
       at async Task<(Struct Return, ImmutableHashSet<Resource> Dependencies)> Pulumi.Deployment.CallRawAsync(string token, CallArgs args, Resource self, CallOptions options, RegisterPackageRequest registerPackageRequest)
       at async Task<OutputData<T>> Pulumi.Deployment.CallAsync<T>(string token, CallArgs args, Resource self, CallOptions options, bool convertResult, RegisterPackageRequest registerPackageRequest)
       at async Task<OutputData<TResult>> Pulumi.Output<T>.ApplyHelperAsync<TResult>(Task<OutputData<T>> dataTask, Func<T, Output<TResult>> func)
       at async Task<OutputData<object>> Pulumi.Output<T>.Pulumi.IOutput.GetDataAsync()
       at async Task<object> Pulumi.Serialization.Serializer.SerializeAsync(string ctx, object prop, bool keepResources, bool keepOutputValues, bool excludeResourceReferencesFromDependencies)
       at async Task<RawSerializationResult> Pulumi.Deployment.SerializeFilteredPropertiesRawAsync(string label, IDictionary<string, object> args, Predicate<string> acceptKey, bool keepResources, bool keepOutputValues, bool excludeResourceReferencesFromDependencies)

Sample program

using System.Collections.Generic;
using Pulumi;
using Aws = Pulumi.Aws;
using Vpc = Pulumi.Vpcmod;

return await Deployment.RunAsync(() =>
{
    var awsProvider = new Aws.Provider("aws-provider", new Aws.ProviderArgs
    {
        Region = "us-west-2"
    });

    // var bucket = new Aws.S3.Bucket("bucket", new Aws.S3.BucketArgs{}, new Pulumi.CustomResourceOptions
    // {
    //     Provider = awsProvider
    // });

    // var vpcProvider = new Vpc.Provider("vpc-provider", new Vpc.ProviderArgs
    // {
    //     Aws = awsProvider.TerraformConfig().Apply(c => c.Result)
    // });

    // var vpc = new Vpc.Module("test-vpc", new Vpc.ModuleArgs
    // {
    //     Azs = new string [] {
    //         "us-west-2a",
    //         "us-west-2b",
    //     },
    //     Cidr = "10.0.0.0/16",
    //     Public_subnets = new string[] {
    //         "10.0.1.0/24",
    //         "10.0.2.0/24"
    //     },
    //     Private_subnets = new string[] {
    //         "10.0.1.0/24",
    //         "10.0.2.0/24"
    //     },
    //     Enable_nat_gateway=true,
    //     Single_nat_gateway=true
    // }, new Pulumi.CustomResourceOptions
    // {
    //     Provider = vpcProvider
    // });

    return new Dictionary<string, object?>
    {
        ["awsConfig"] = awsProvider.TerraformConfig().Apply(c => c.Result)
        // ["publicSubnets"] = vpc.Public_subnets,
        //["privateSubnets"] = vpc.Private_subnets
    };
});

Log output

No response

Affected Resource(s)

N/A

Output of pulumi about

running 'dotnet build -nologo'
  Determining projects to restore...

  All projects are up-to-date for restore.

/Users/anton/.nuget/packages/microsoft.build.tasks.git/1.0.0/build/Microsoft.Build.Tasks.Git.targets(24,5): warning : Unable to locate repository with working directory that contains directory '/Users/anton/tmp/2025-06-24/dotnet-blog-examples/sdks/vpcmod'. [/Users/anton/tmp/2025-06-24/dotnet-blog-examples/sdks/vpcmod/Pulumi.Vpcmod.csproj]

/Users/anton/.nuget/packages/microsoft.build.tasks.git/1.0.0/build/Microsoft.Build.Tasks.Git.targets(47,5): warning : Unable to locate repository with working directory that contains directory '/Users/anton/tmp/2025-06-24/dotnet-blog-examples/sdks/vpcmod'. [/Users/anton/tmp/2025-06-24/dotnet-blog-examples/sdks/vpcmod/Pulumi.Vpcmod.csproj]

/Users/anton/.nuget/packages/microsoft.sourcelink.common/1.0.0/build/Microsoft.SourceLink.Common.targets(52,5): warning : Source control information is not available - the generated source link is empty. [/Users/anton/tmp/2025-06-24/dotnet-blog-examples/sdks/vpcmod/Pulumi.Vpcmod.csproj]

  Pulumi.Vpcmod -> /Users/anton/tmp/2025-06-24/dotnet-blog-examples/sdks/vpcmod/bin/Debug/net6.0/Pulumi.Vpcmod.dll

  dotnet-blog-examples -> /Users/anton/tmp/2025-06-24/dotnet-blog-examples/bin/Debug/net8.0/dotnet-blog-examples.dll



Build succeeded.


/Users/anton/.nuget/packages/microsoft.build.tasks.git/1.0.0/build/Microsoft.Build.Tasks.Git.targets(24,5): warning : Unable to locate repository with working directory that contains directory '/Users/anton/tmp/2025-06-24/dotnet-blog-examples/sdks/vpcmod'. [/Users/anton/tmp/2025-06-24/dotnet-blog-examples/sdks/vpcmod/Pulumi.Vpcmod.csproj]
/Users/anton/.nuget/packages/microsoft.build.tasks.git/1.0.0/build/Microsoft.Build.Tasks.Git.targets(47,5): warning : Unable to locate repository with working directory that contains directory '/Users/anton/tmp/2025-06-24/dotnet-blog-examples/sdks/vpcmod'. [/Users/anton/tmp/2025-06-24/dotnet-blog-examples/sdks/vpcmod/Pulumi.Vpcmod.csproj]
/Users/anton/.nuget/packages/microsoft.sourcelink.common/1.0.0/build/Microsoft.SourceLink.Common.targets(52,5): warning : Source control information is not available - the generated source link is empty. [/Users/anton/tmp/2025-06-24/dotnet-blog-examples/sdks/vpcmod/Pulumi.Vpcmod.csproj]
    3 Warning(s)
    0 Error(s)



Time Elapsed 00:00:00.65

'dotnet build -nologo' completed successfully
CLI          
Version      3.178.0
Go Version   go1.24.4
Go Compiler  gc

Plugins
KIND      NAME    VERSION
resource  aws     6.83.0
language  dotnet  unknown

Host     
OS       darwin
Version  15.5
Arch     arm64

This project is written in dotnet: executable='/run/current-system/sw/bin/dotnet' version='9.0.205'

Current Stack: anton-pulumi-corp/dotnet-blog-examples/dev

Found no resources associated with dev

Found no pending operations associated with dev

Backend        
Name           pulumi.com
URL            https://app.pulumi.com/anton-pulumi-corp
User           anton-pulumi-corp
Organizations  anton-pulumi-corp, moolumi, demo, pulumi
Token type     personal

Dependencies:
NAME        VERSION
Pulumi      3.84.0
Pulumi.Aws  6.83.0

Pulumi locates its logs in /var/folders/gd/3ncjb1lj5ljgk8xl5ssn_gvc0000gn/T/com.apple.shortcuts.mac-helper// by default

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSome behavior is incorrect or out of spec

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions