1

I am trying to provision resource group with below class. Calling it from the stack class but facing some issue with the output variable.

class GenerateResourceGroup
{
    public GenerateResourceGroup(Input<string> location, Input<string> rgName, Dictionary<string, string> tags)
    {
        Console.WriteLine(location);
        Console.WriteLine(rgName);
        var config = new Pulumi.Config();
        var resourceGroup = new Pulumi.AzureNative.Resources.ResourceGroup("resourceGroup", new Pulumi.AzureNative.Resources.ResourceGroupArgs
        {
            Location = location,
            ResourceGroupName = rgName,
            Tags = tags,
        });
        resourceGroupName = resourceGroup.Name;
    }
    [Output]
    public Output<string> resourceGroupName { get; }
}

Error: Even I tried to utilize apply but still getting error.

Pulumi.Input1[System.String] Pulumi.Input1[System.String] Calling [ToString] on an [Output] is not supported. To get the value of an Output as an Output consider: 1. o.Apply(v => $"prefix{v}suffix") 2. Output.Format($"prefix{hostname}suffix"); See https://pulumi.io/help/outputs for more details.

jps
  • 20,041
  • 15
  • 75
  • 79
  • Your code looks fine expect for `Console.WriteLine` that prints `Input` directly. If you just remove those console statements, does the rest work for you? – Mikhail Shilkov Jun 29 '22 at 12:12
  • i removed the console.writeline, but getting error Detail="invocation of azure-native:authorization:getClientConfig returned an error: getting authenticated object ID: Error parsing json result from the Azure CLI: Error retrieving running Azure CLI: WARNING: This command or command group has been migrated to Microsoft Graph API. Please carefully review all breaking changes introduced during this migration: https://learn.microsoft.com/cli/azure/microsoft-graph-migration") – Ashwani Kumar Jun 29 '22 at 12:36

1 Answers1

0

It was an issue with the cli.. i uninstalled the latest version of CLI and installed old version 2.33.1. That has solved the problem. It's all bcoz underlying api due to the depreciation of the API.. learn.microsoft.com/cli/azure/microsoft-graph-migration