Originally, it was:
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
),
)
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,
),
)