mysterious-australia-14256
09/30/2021, 12:21 PMintegrationRuntime.Name.Apply(n =>
{
var authKey = Pulumi.AzureNative.DataFactory.ListIntegrationRuntimeAuthKeys.InvokeAsync(new Pulumi.AzureNative.DataFactory.ListIntegrationRuntimeAuthKeysArgs
{
FactoryName = runtimeSettings.DataFactoryName,
ResourceGroupName = runtimeSettings.DataFactoryResourceGroup,
IntegrationRuntimeName = n
}).Result.AuthKey1;
return n;
});
tall-librarian-49374
09/30/2021, 12:26 PMstring
from Output<string>
because you’d loose the dependency tracking then. Why do you need your auth key to be a plain string? You can usually pass outputs as inputs to other resources.mysterious-australia-14256
09/30/2021, 1:06 PMtall-librarian-49374
09/30/2021, 1:26 PMmysterious-australia-14256
09/30/2021, 1:43 PMtall-librarian-49374
09/30/2021, 2:01 PMOutput<X>
where X is what ProtectedSettings needsmysterious-australia-14256
09/30/2021, 2:02 PMvar myIR = new Pulumi.AzureNative.DataFactory.IntegrationRuntime(<some settings>);
I then need to get the authKey which requires code like
var authKey = Pulumi.AzureNative.DataFactory.ListIntegrationRuntimeAuthKeys.InvokeAsync(new Pulumi.AzureNative.DataFactory.ListIntegrationRuntimeAuthKeysArgs
{
FactoryName = "dfname"
ResourceGroupName = "rgname",
IntegrationRuntimeName = myIR.Name
}).Result.AuthKey1;
The problem here is that IntegrationRuntimeName only accepts a string (not an Input<string>) so I am just wrapping all of that in an Apply for the myIR object just to ensure that myIR exists (as there isn't a dependsOn option for ListIntegrationRuntimeAuthKeys)
var commandToExecute = myIR.Name.Apply<string>(name =>
{
var authKey = Pulumi.AzureNative.DataFactory.ListIntegrationRuntimeAuthKeys.InvokeAsync(new Pulumi.AzureNative.DataFactory.ListIntegrationRuntimeAuthKeysArgs
{
FactoryName = "dfname",
ResourceGroupName = "rgname",
IntegrationRuntimeName = name
}).Result.AuthKey1;
var commandToExecute = $"powershell.exe -ExecutionPolicy Unrestricted -File gatewayInstall.ps1 {authKey}";
return commandToExecute;
});
I am no longer creating anything inside of the Apply.
Does that look like the best way to proceed given I can't apply an Input<string> to IntegrationRuntimeName?tall-librarian-49374
09/30/2021, 2:50 PMvar commandToExecute = myIR.Name.Apply<string>(async name =>
{
var authKey = (await Pulumi.AzureNative.DataFactory.ListIntegrationRuntimeAuthKeys.InvokeAsync(new Pulumi.AzureNative.DataFactory.ListIntegrationRuntimeAuthKeysArgs
{
FactoryName = "dfname",
ResourceGroupName = "rgname",
IntegrationRuntimeName = name
})).AuthKey1;
var commandToExecute = $"powershell.exe -ExecutionPolicy Unrestricted -File gatewayInstall.ps1 {authKey}";
return commandToExecute;
});
mysterious-australia-14256
09/30/2021, 3:02 PM