Hey all, Pulumi Alias question, I am having an iss...
# general
s
Hey all, Pulumi Alias question, I am having an issue migrating from an old version of https://github.com/pulumi/pulumi-snowflake to newer. A type of resource was removed (moved to another name) Type: snowflakeindexRole changed to snowflakeindexAccountRole Issue: I need to keep my Roles and was hoping I could use alias to shuffle these resources from Role into AccountRole Was hoping this would work but I see DELETE (Role) and CREATE (AccountRole) with same information. Go code:
Copy code
// Add pulumi Alias to move to the new Type -- <https://www.pulumi.com/docs/concepts/options/aliases/>
roleOpts := append(opts, pulumi.Aliases([]pulumi.Alias{
    // Combination of name and type is enough to be unique.
    {Name: pulumi.String(strings.ToLower(roleName)),
       // Previous to refactor - created the type snowflake:index:Role.
       Type: pulumi.String("snowflake:index:Role"),
    },
}))

role, err := snowflake.NewAccountRole(ctx, strings.ToLower(roleName), &snowflake.AccountRoleArgs{
    Name: pulumi.String(roleName),
}, roleOpts...)
if err != nil {
    return nil, nil, err
}
Is there something wrong with my Alias?
a
have you tried with the full
urn
name?
s
We load from a yaml, with a list of users/roles for them. I could try it out though and see what happens.
This clicked for me, and worked! Doesn’t look to want to delete these old roles. Thank you for the idea I should have realized.
Copy code
URN: pulumi.URN(fmt.Sprintf("urn:pulumi:uat::wh::snowflake:index/role:Role::%s", strings.ToLower(roleName))),