我正在尝试在堆栈中创建两个单独的存储桶,但是当我尝试将文件写入第二个存储桶时,它与第一个存储桶中的任何文件同名,但出现错误
error: Duplicate resource URN 'urn:pulumi:dev::quickstart::aws:s3/bucketObject:BucketObject::index.html'; try giving it a unique name
下面的代码演示了这个问题。
显然,就 AWS 而言,没有冲突,但是我应该定义一个不同的“名称”来防止 Pulumi 创建看似重复的密钥吗?
using Pulumi;
using Pulumi.Aws.S3;
class MyStack : Stack
{
public MyStack()
{
// Create an AWS resource (S3 Bucket)
var bucket1 = new Bucket("my-bucket");
var bucketObject1 = new BucketObject("index.html", new BucketObjectArgs {
Bucket = bucket1.BucketName,
Content = "HTML in 1"
});
var bucket2 = new Bucket("my-bucket2");
var bucketObject2 = new BucketObject("index.html", new BucketObjectArgs {
Bucket = bucket2.BucketName,
Content = "HTML in 2"
});
}
}