My attempts at importing aws resources through a r...
# aws
s
My attempts at importing aws resources through a runtime transform aren't working as expected. The problem seems to be with the transform function itself. I've simplified the scenario by using the aws-python simple s3 bucket base. I first ran this with the register_resource_transform line commented out to create the s3 bucket, then commented out the bucket to remove it from the state knowledge. Next, I put the s3 bucket name into the transform function and ran pulumi up. if I add import_='temporary-test-pulumi-bucket-20250925-c104c53' into the opts of the bucket line, it does recognize that it needs to be imported. However, the transform function does nothing, and the stack sees it as needing to be created. Thanks!
Copy code
import pulumi
from pulumi_aws import s3

def cloudformation_import_transform(args: pulumi.ResourceTransformArgs):

    return pulumi.ResourceTransformResult(
        props=args.props,
        opts=pulumi.ResourceOptions.merge(
            args.opts, pulumi.ResourceOptions(
                import_ = 'temporary-test-pulumi-bucket-20250925-c104c53'
            )
        )
    )


pulumi.runtime.register_resource_transform(cloudformation_import_transform)

bucket = s3.Bucket('temporary-test-pulumi-bucket-jm-20250925', opts=pulumi.ResourceOptions(retain_on_delete=True))

pulumi.export('bucket_name', bucket.id)
e
Ah yup, looks like the import option got missed when plumbing transforms in. Should be a quick fix and we can hopefully have it working in the next release.
s
When would you expect the next release?
e
Normally they're Wednesday each week
Which should be enough time to fix this and get it merged
s
thanks!
e
https://github.com/pulumi/pulumi/pull/20586 Should merge soon, so will be in next weeks release