https://pulumi.com logo
#general
Title
# general
r

rich-pizza-78121

08/08/2023, 6:10 PM
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

salmon-account-74572

08/08/2023, 7:19 PM
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

rich-pizza-78121

08/08/2023, 7:23 PM
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

salmon-account-74572

08/08/2023, 7:25 PM
OK, looks like it’s not explicit naming, then. 🙂 Are you able to share more details, perhaps including the code you’re using?
r

rich-pizza-78121

08/08/2023, 7:27 PM
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

salmon-account-74572

08/08/2023, 7:29 PM
Gimme a minute and let me see if I can repro your behavior
What version of Pulumi, and what version of Python?
r

rich-pizza-78121

08/08/2023, 7:30 PM
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

salmon-account-74572

08/08/2023, 7:34 PM
Can you share the contents of your
requirements.txt
file?
r

rich-pizza-78121

08/08/2023, 7:35 PM
Copy code
pulumi>=3.0.0,<4.0.0
pulumi-aws>=5.0.0,<6.0.0
s

salmon-account-74572

08/08/2023, 7:37 PM
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

rich-pizza-78121

08/08/2023, 7:38 PM
s

salmon-account-74572

08/08/2023, 7:39 PM
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

rich-pizza-78121

08/08/2023, 7:41 PM
this is the error
what python version are you using?
s

salmon-account-74572

08/08/2023, 7:43 PM
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

rich-pizza-78121

08/08/2023, 7:43 PM
No, I don't
my stack is completely empty, i'm just getting started
s

salmon-account-74572

08/08/2023, 7:44 PM
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

rich-pizza-78121

08/08/2023, 7:45 PM
No, I even introduced random letters to it and the same
s

salmon-account-74572

08/08/2023, 7:46 PM
Can you run
pulumi plugin ls
and tell me what version(s) of the AWS provider are present on your system?
r

rich-pizza-78121

08/08/2023, 7:46 PM
5.42.0
s

salmon-account-74572

08/08/2023, 7:50 PM
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

rich-pizza-78121

08/08/2023, 7:50 PM
thank you, I can do that
s

salmon-account-74572

08/08/2023, 7:52 PM
Thank you!
e

echoing-dinner-19531

08/08/2023, 8:25 PM
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

salmon-account-74572

08/08/2023, 8:34 PM
@rich-pizza-78121 Any chance you could try on a newer version of Python?
r

rich-pizza-78121

08/08/2023, 8:35 PM
I can try that. In the meantime I opened this https://github.com/pulumi/pulumi/issues/13680
s

salmon-account-74572

08/08/2023, 8:36 PM
Thank you!
r

rich-pizza-78121

08/09/2023, 2:35 PM
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

echoing-dinner-19531

08/09/2023, 2:44 PM
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

salmon-account-74572

08/09/2023, 4:35 PM
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

numerous-train-50906

10/05/2023, 5:41 PM
@echoing-dinner-19531 - Hi! I've run into this issue as well. Is the recommendation to upgrade to Python 3.11?
e

echoing-dinner-19531

10/05/2023, 7:00 PM
Yes, 3.11 should work.