Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Pulumi 有没有办法访问当前的堆栈名称,以便在执行 pulumi up 时选择要运行的类?
我想做这样的事情:
static Task<int> Main() { if (Deployment.Instance.StackName.StartsWith("local-")) return Deployment.RunAsync<LocalStack>(); return Deployment.RunAsync<AzureStack>(); }
Deployment.Instance在您执行之前不可用RunAsync,您已经知道了。
Deployment.Instance
RunAsync
作为一种解决方法,您可以从环境变量中获取堆栈名称:
Environment.GetEnvironmentVariable("PULUMI_STACK")