Hello. I have seen this error around but no appare...
# general
r
Hello. I have seen this error around but no apparent solution "error: Duplicate resource URN 'blah-some-urn'; try giving it a unique name". I'm just POCing pulumi and starting up with these docs. The error is happening out of the box. I have nothing in the stack/ Any suggestions? https://www.pulumi.com/docs/clouds/aws/get-started/create-project/
s
Are you explicitly assigning names to your resources, like
name: blah-some-name
? That can sometimes cause this error. Pulumi does provide some auto-naming functionality that can help: https://www.pulumi.com/docs/concepts/resources/names/
r
Using Python, just following the docs something like
Copy code
bucket = s3.Bucket("my-bucket-name")

# Export the name of the bucket
pulumi.export("bucket_name", bucket.id)
s
OK, looks like it’s not explicit naming, then. 🙂 Are you able to share more details, perhaps including the code you’re using?
r
Of course, it's only this much so far
Copy code
import pulumi
from pulumi_aws import s3


def create():
    # Create an AWS resource (S3 Bucket)
    bucket = s3.Bucket("my-bucket-name")

    # Export the name of the bucket
    pulumi.export("bucket_name", bucket.id)


create()
s
Gimme a minute and let me see if I can repro your behavior
What version of Pulumi, and what version of Python?
r
3.77.1 and 3.8.13 respectively
My use case is to POC it and see if we can migrate from TF to Pulumi
s
Can you share the contents of your
requirements.txt
file?
r
Copy code
pulumi>=3.0.0,<4.0.0
pulumi-aws>=5.0.0,<6.0.0
s
Hmm, matches mine, and I also used the same
pulumi new aws-python
command that you used from the guide. I can’t reproduce the same behavior (CLI version 3.76.1 with Python 3.11.4 on macOS 13.4.1). What state backend are you using? You can use
pulumi whoami -v
for details.
r
s
OK, you’re using Pulumi Cloud (as am I). I can’t easily downgrade Python, but I can try the newer Pulumi CLI release to see if that does anything. Gimme a few minutes.
r
this is the error
what python version are you using?
s
And just to be sure: you don’t have an existing bucket with that name, right? (Stupid question, I know, but I have to ask.)
I’m using Python 3.11.4
r
No, I don't
my stack is completely empty, i'm just getting started
s
Right, I figured your stack was empty, but if there is a bucket out there in S3 with that name---regardless of whether it was created by Pulumi or not---then it’s an issue.
r
No, I even introduced random letters to it and the same
s
Can you run
pulumi plugin ls
and tell me what version(s) of the AWS provider are present on your system?
r
5.42.0
s
OK, that shoots down another theory, and I can’t reproduce with CLI 3.77.1. This behavior is definitely unexpected. Would you mind opening an issue in https://github.com/pulumi/pulumi? In the meantime, I’ll try to get some engineering attention on this thread and see if they have some ideas. Sorry that you’re running into this!
r
thank you, I can do that
s
Thank you!
e
This is a very odd case, but I wonder if its some oddity of python 3.8. We don't test on that any more.
s
@rich-pizza-78121 Any chance you could try on a newer version of Python?
r
I can try that. In the meantime I opened this https://github.com/pulumi/pulumi/issues/13680
s
Thank you!
r
It seems python 3.8 is not supported. It worked with Python 3.11. It would be good to add that to the docs, are at least make it visible if it's buried somewhere
e
I was sure this was in the docs but it looks like they still refer to 3.7! I'll get that fixed up.
https://www.pulumi.com/docs/languages-sdks/python/
Pulumi supports writing your infrastructure as code in the Python language running on any supported version.
Install Python version 3.7 or later.
That first link is correct, 3.7 is end-of-life and no longer supported. The second link that actual has the version number saying install 3.7 is wrong.
s
Thanks for testing, Fernando, and confirming that Python 3.11 works! Fraser, I’ve already reviewed the docs PR change and we’ll get that merged shortly.
n
@echoing-dinner-19531 - Hi! I've run into this issue as well. Is the recommendation to upgrade to Python 3.11?
e
Yes, 3.11 should work.