pulumi / pulumi-synced-folder

A Pulumi component that synchronizes a local folder to Amazon S3, Azure Blob Storage, or Google Cloud Storage.
Apache License 2.0
3 stars 3 forks source link

Error: Duplicate resource URN, duplicate resource alias #10

Closed AaronFriel closed 1 year ago

AaronFriel commented 1 year ago

Handling "Duplicate resource URN" and "Duplicate resource alias"

If you see errors like "Duplicate resource alias ...", check if you are creating more than one folder object of S3BucketFolder, AzureBlobFolder, or GoogleCloudFolder. Update to v0.1.0 of the provider if you are seeing this issue and using multiple folder resources.

After updating to v0.1.0, on every resource except the first, add an input to the resource disableManagedObjectAliases. That may look something like this, using TypeScript as an example:

const folder = new synced.S3BucketFolder("synced-folder", {
    path: "./my-folder",
    bucketName: bucket.bucket,
    acl: aws.s3.PublicReadAcl,
    disableManagedObjectAliases: true,
});

This will allow your program to complete, and you should see output like the following in a pulumi preview, with no deletes or replaces:

     Type                                   Name                        Plan
     pulumi:pulumi:Stack                    synced-folder-aws-yaml-dev
 +   ├─ aws:s3:Bucket                       my-bucket-2                 create
 +   └─ synced-folder:index:S3BucketFolder  synced-folder-2             create
 +      └─ aws:s3:BucketObject              synced-folder-2-index.html  create

If you see folders being deleted and aren't sure, reach out in an issue or on our Community Slack for support.

Future releases

This field will be removed in v0.2.0 after a period of time to allow users to migrate. Users should run a deployment using v0.1.0 before updating to v0.2.0.

With the field aliases removed, users upgrading directly to v0.2.0 directly will see Pulumi plan a "create" and "delete". Deploying on v0.1.0 will rename the resources to prevent this.