Hi all, what is the preferred way to migrate Pulum...
# aws
Hi all, what is the preferred way to migrate Pulumi resources from the AWS Classic provider to AWS Native provider? I'm running into some issues migrating an IAM role for example. I'm adding the new aws-native provider and added a type alias to
like so:
Copy code
  resource_name="role", # unchanged
  role_name="example-role", # unchanged,
  opts=pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(aliases=[Alias(type_="aws:iam/role:Role")]))
But Pulumi is still trying to replace the resource even though nothing has changed except the provider
The type isn't enough to define the original resource. You'll also need at least the name, and maybe the parent.
Those properties are used to build the URN of the original resource. It might be easier just to use the URN. The values in the aliases array don't have to the instances of Alias, they can be URNs.
You can get the original resources' URNs from a stack export or the Pulumi app.
The resource I'm talking about is a
and is used in multiple projects so passing a fixed URN is going to be cumbersome. I'll try passing the original name, parent and type. Thanks!
You almost certainly won't be able to set up an alias inside the code of a ComponentResource that caters for all the places that resource can be constructed. You will probably want to pass the alias, or at least the parent of the parent, into the constructor.
I am curious for your reasons to migrate to native? The "even though nothing has changed except the provider" is a very big assumption, the resources manage the same cloud state but are not designed to be compatible, so I'm expecting what you attempt to be possible but rather difficult especially at scale.