Pulumi C#:将堆栈输出标记为机密

Pulumi C#: mark stack output as a secret

我正在创建一个将与多个堆栈共享的 ACR,我需要输出中的信息

如何保护密码输出?

using Pulumi;
using Pulumi.Azure.Core;
using Pulumi.Azure.ContainerService;

class MyStack : Stack
{
    public MyStack()
    {
        string baseName = $"{Deployment.Instance.ProjectName}-{Deployment.Instance.StackName}";
        string restrictedName = baseName.ToLower().Replace("-", "");

        var resourceGroup = new ResourceGroup("resourceGroup", new ResourceGroupArgs
        {
            Name = baseName
        });

        var acr = new Registry("myorg-acr", new RegistryArgs
        {
            Name = $"{restrictedName}acr",
            ResourceGroupName = resourceGroup.Name,
            Sku = "Basic",
            AdminEnabled = true
        });

        AcrLoginServer = acr.LoginServer;
        AcrAdminUsername = acr.AdminUsername;
        AcrAdminPassword = acr.AdminPassword;
    }

    [Output]
    public Output<string> AcrLoginServer { get; private set; }
    [Output]
    public Output<string> AcrAdminUsername { get; private set; }
    [Output]
    public Output<string> AcrAdminPassword { get; private set; }
}

您应该能够像这样将输出标记为机密:

AcrAdminPassword = registry.AdminPassword.Apply(Output.CreateSecret);