nice-bear-3100
09/01/2024, 3:58 PMclever-sunset-76585
09/01/2024, 9:56 PMnice-bear-3100
09/01/2024, 10:45 PMreturn await Deployment.RunAsync(
PulumiApp,
new StackOptions {
ResourceTransformations = [
MyTransformations.GetTransformation()
]
});
But even though I searched for hours I couldn't find any call that receives that type (of the transformation): ResourceTransformation
.
Neither the LocalWorkspace
methods, nor any *ProgramArgs
type or anything else in the automation API seems to have any parameter that receives it.
So I'm kindda lost...clever-sunset-76585
09/01/2024, 11:42 PMnice-bear-3100
09/02/2024, 1:34 AMreturn await Deployment.RunAsync(
PulumiApp,
new StackOptions {
ResourceTransformations = [
AutoTagger.CreateAutoTaggingTransformation(),
]
});
async Task<IDictionary<string, object?>> PulumiApp() {
// ... not really important ...
return outputs;
}
nice-bear-3100
09/02/2024, 1:34 AMAutoTagger
that's being referenced above:
public static class AutoTagger {
public static ResourceTransformation CreateAutoTaggingTransformation(ICloudResources cloudResources) =>
args => {
// ... add tags to resources ...
return new ResourceTransformationResult(args.Args, args.Options);
};
}
nice-bear-3100
09/02/2024, 1:37 AMAutoTagger
, then there is just no place to call it with the automation APInice-bear-3100
09/02/2024, 1:37 AMpublic class PulumiAutomationWorkspaceRunner(string projectName, string stackName, Func<AppName, Task<Dictionary<string, object?>>> program) {
private readonly Task<WorkspaceStack> stackTask = LocalWorkspace.CreateOrSelectStackAsync(
new InlineProgramArgs(projectName, stackName, PulumiFn.Create(async () => await program(new AppName()))
) {
EnvironmentVariables = new Dictionary<string, string?> {
["AWS_PROFILE"] = Hub.AwsProfile,
},
}
);
public async Task<IImmutableDictionary<string, OutputValue>> Up() {
try {
WorkspaceStack stack = await stackTask;
var version = typeof(Provider).Assembly.GetName().Version!.ToString()[..^2];
await stack.Workspace.InstallPluginAsync("aws", version);
UpResult upResult = await stack.UpAsync(new UpOptions { OnEvent = handler.Hanlder });
return upResult.Outputs;
} catch (Exception e) {
Console.Error.WriteLine(e);
throw;
}
}
/*
...
*/
}
nice-bear-3100
09/02/2024, 1:38 AMResourceTransformation
, which is what the AutoTagger.CreateAutoTaggingTransformation
returnsnice-bear-3100
09/02/2024, 1:39 AMclever-sunset-76585
09/02/2024, 3:28 AMprogram
in that second snippet? It looks like you are defining an inline program based on your use of InlineProgramArgs
. Whatever that method is doing, you should define the autotagger transformation in there.clever-sunset-76585
09/02/2024, 3:52 AMnice-bear-3100
09/02/2024, 10:37 AMpublic class DbTasks(AppName appName) {
public static void Up() => Stacker.Up().Wait();
private static readonly PulumiAutomationWorkspaceRunner Stacker = new(
"ca",
"autotestingstack",
async appName => await new DbTasks(appName).Run()
);
private async Task<Dictionary<string, object?>> Run() {
Cluster dbCluster = new Cluster(appName.UnderScored, new ClusterArgs { /* ... */ });
return new() {
["cluster"] = dbCluster.Endpoint,
};
}
}
This is basically the entry point of the application, which is essentially just creating a DB Cluster
(it's a testing code).
But there too - there is no place to insert a ResourceTransformation
, unless I'm missing something.
PulumiFn.Create
doesn't have any parameter of that type, or any other type that may contain such thing: https://www.pulumi.com/docs/reference/pkg/dotnet/Pulumi.Automation/Pulumi.Automation.PulumiFn.htmlnice-bear-3100
09/02/2024, 10:48 AMDeployment.RunAsync
call to launch it (where I also place the transformation), but when calling that Deployment.RunAsync
call from the automation API, it's throwing an error: `Program run without the Pulumi engine available; re-run using the pulumi
CLI`nice-bear-3100
09/02/2024, 10:50 AMDeployment.RunAsync
callbillions-carpenter-44546
09/09/2024, 2:19 PMnice-bear-3100
09/10/2024, 8:53 PM