这是我的用例:
我有一个 blob 资源,仅当我的构建机器上存在文件(来自我的 CI 服务器的 artifcat)时才会创建。
现在,我可能必须在文件不存在的本地机器上运行 pulumi。但我不想删除 blob 资源。该 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;