下面是我的用例:
我有一个blob资源,只有当我的构建机器上存在一个文件(来自CI服务器的artifcat)时才会创建它。
现在,我可能必须在文件不存在的本地计算机上运行pulumi。但我不想删除blob资源。该斑点仍然存在于Azure上。
if (fs.existsSync(fullFileName)) {
// On the build server, I update the blob with the new artifact
const blob = new azure.storage.Blob("myblob-b", {
name: fileName,
source: fullFileName,
resourceGroupName: resourceGroup.name,
storageAccountName: storageAccount.name,
storageContainerName: zipDeployContainer.name,
type: "block"
})
} else {
// On my local machine, the artifact does not exists but I want to keep it
const stackRef = new pulumi.StackReference(`${organization}/${projectName}/${stackName}`);
const srblob = stackRef.getOutput("zipblob");
// How do I tell pulumi keep the resource from the stack reference
}
export const zipblob = blob;发布于 2019-02-22 01:18:17
好吧,我还不够聪明,在pulumi slack上的人帮了我。基本上你可以使用StackReference。具体地说就是getOutput方法。
https://stackoverflow.com/questions/54811055
复制相似问题