important-holiday-25047
09/01/2022, 11:49 AM+- azure-native:storage:BlobServiceProperties blobServiceProperties replace [diff: ~accountName,cors]
++ azure-native:storage:BlobServiceProperties blobServiceProperties create replacement [diff: ~accountName,cors]
++ azure-native:storage:BlobServiceProperties blobServiceProperties replace [diff: ~accountName,cors]; error: Duplicate resource URN 'urn:pulumi:Staging::cloud::azure-native:storage:BlobServiceProperties::blobServiceProperties'; try giving it a unique name
echoing-dinner-19531
09/01/2022, 12:05 PMimportant-holiday-25047
09/01/2022, 12:45 PMripe-russia-4239
09/01/2022, 1:00 PMimportant-holiday-25047
09/01/2022, 1:05 PMexport const documentStorage = createStorage({
parentKey: "DocumentStorage",
name: "bsdocuments",
receiveAccount: a => documentStorageAccount= a
});
export const documentStorage = createStorage({
parentKey: "DocumentStorage",
name: "bsdocuments",
corsRules: !isProduction() ?
[
{
allowedHeaders: ["*"],
allowedMethods: ["GET", "POST", "PUT"],
allowedOrigins: ["*"],
exposedHeaders: ["*"],
maxAgeInSeconds: 60,
}
] : [],
receiveAccount: a => documentStorageAccount= a
});
echoing-dinner-19531
09/01/2022, 1:09 PMimportant-holiday-25047
09/01/2022, 1:09 PMname : "default" => Output<T>
type : "Microsoft.Storage/storageAccounts/blobServices" => Output<T>
I changed it now so the cors is set as the last parameter in the parameter object, now I have no diff anymore, but still the same errorechoing-dinner-19531
09/01/2022, 1:34 PMimportant-holiday-25047
09/02/2022, 7:53 AMfunction createStorage(args: IStorageSettings): ISetting[] {
const storageAccount= createStorageAccount(args.name, args.corsRules);
if (args.receiveAccount)
args.receiveAccount(storageAccount);
const connectionString = createConnectionString(storageAccount);
const appSettingsKey= `${args.parentKey}__ConnectionString`;
return [
{
name: appSettingsKey,
value: connectionString
}
];
}
function createStorageAccount(name: string, corsRules?: types.input.storage.CorsRuleArgs[], resourceGrp?: string): storage.StorageAccount {
const result= new storage.StorageAccount(name, {
resourceGroupName: resourceGrp ?? resourceGroupName,
kind: storage.Kind.StorageV2,
sku: { name: storage.SkuName.Standard_RAGRS }
}, {protect: true});
if (corsRules) {
new storage.BlobServiceProperties("blobServiceProperties", {
accountName: result.name,
blobServicesName: "default",
cors: {
corsRules
},
defaultServiceVersion: "2017-07-29",
resourceGroupName: resourceGroupName,
});
}
return result;
}
Those are the 2 methods that are used to create the storageechoing-dinner-19531
09/02/2022, 9:25 AMShouldn't that make use of "name" as well to make sure it's unique? Call this method twice and you'll get two objects called "blobServiceProperties"new storage.BlobServiceProperties("blobServiceProperties", {
important-holiday-25047
09/02/2022, 10:16 AM