average-school-38756
02/11/2021, 4:05 PMname="my-name"
shows no changes detected for pulumi up
, yet that same resource with opts=ResourceOptions(aliases=[Alias(name="my-name")]}
instead wants to do a "replace" based on a detected name changered-match-15116
02/11/2021, 4:34 PMaverage-school-38756
02/11/2021, 4:40 PMname
value when i move the old one to aliases
? can't transition to auto-generated names?red-match-15116
02/11/2021, 8:31 PMbucket = s3.Bucket("my-bucket")
would use autonaming to create a bucket named my-bucket-[random-integers]
If you wanted to change the resource name of the bucket without replacing it you would do something like:
bucket = s3.Bucket("new-bucket-name", opts=ResourceOptions(aliases=[Alias(name="my-bucket")])
average-school-38756
02/11/2021, 8:57 PMaws.dynamodb.Table(
"foo",
attributes=[aws.dynamodb.TableAttributeArgs(name="bar", type="S")],
hash_key="bar",
billing_mode="PAY_PER_REQUEST",
opts=pulumi.ResourceOptions(
protect=True
),
)
Then a resource called "foo-e876689" was created. After successfully importing the resource into a new project/stack, i wanted to remove the explicit name
value, to keep the code generic. i tried using aliases for this:
aws.dynamodb.Table(
"foo",
attributes=[aws.dynamodb.TableAttributeArgs(name="bar", type="S")],
hash_key="bar",
billing_mode="PAY_PER_REQUEST",
opts=pulumi.ResourceOptions(
protect=True, aliases=[pulumi.Alias(name="foo-e876689")]
),
)
But if i remove name="foo-e876689"
it doesn't know to not replace, even with the alias defined. Only this works:
aws.dynamodb.Table(
"foo",
name="foo-e876689",
attributes=[aws.dynamodb.TableAttributeArgs(name="bar", type="S")],
hash_key="bar",
billing_mode="PAY_PER_REQUEST",
opts=pulumi.ResourceOptions(
protect=True,
),
)
red-match-15116
02/11/2021, 9:40 PMname
property.average-school-38756
02/11/2021, 9:40 PM