sparse-intern-71089
11/13/2020, 2:54 PMnice-oyster-71086
11/27/2020, 7:00 PMconfig.RequireSecret("<secret>")
returns a type of Output<string>
which I can't seem to get at.powerful-printer-57241
11/28/2020, 11:38 AMbored-activity-40468
11/28/2020, 5:07 PMwitty-candle-66007
11/30/2020, 9:52 PMdatabaseServerPassword
can’t be used because it’s an Output<string>
. This is as per https://www.pulumi.com/docs/intro/concepts/programming-model/#how-secrets-relate-to-outputs
So .Apply
needs to be used and the reference to the secret variable used within the apply.
Here is some example code where the secret is used within the .Apply
to create a resource group:
class MyStack : Stack
{
public MyStack()
{
var config = new Pulumi.Config();
var rgName = config.GetSecret("rgName");
// Create an Azure Resource Group
var resourceGroupName = rgName.Apply(rgn => {
var rg = new ResourceGroup(rgn, new ResourceGroupArgs
{
Name = rgn,
});
return rg.Name;
});
var storageAccount = new Account("storage", new AccountArgs
{
ResourceGroupName = resourceGroupName,
AccountReplicationType = "LRS",
AccountTier = "Standard"
});
this.ResourceGroupName = resourceGroupName;
this.ConnectionString = storageAccount.PrimaryConnectionString;
}
[Output]
public Output<string> ResourceGroupName { get; set; }
[Output]
public Output<string> ConnectionString { get; set; }
}
powerful-printer-57241
12/01/2020, 8:01 AMwitty-candle-66007
12/01/2020, 1:47 PM