https://pulumi.com logo
Title
q

quaint-electrician-41503

10/08/2020, 2:45 AM
Am I missing something? I go to create a bucket with
aws.s3.Bucket("rd70-stream-dev" ..)
But my bucket is created as
rd70-stream-dev-23095803
. I don't know where I get the additional, unwanted
-23095803
. Maybe I'm missing a basic s3 principal, but can't I provide arguments to not create the bucket in this case?
l

little-cartoon-10569

10/08/2020, 2:47 AM
That's intentional (and described somewhere in the docs), to allow Pulumi to easily create the delete when doing a replace. For most resources, you can't have two instances with the same name.
It is possible to override the name any time you want, but then you have to enable delete-before-create so that replaces can happen.
l

little-cartoon-10569

10/08/2020, 2:48 AM
Generally a better option is just to ensure that the Name tag is always set. AWS uses that for most resources as a "user friendly" name, in preference to the ID.
q

quaint-electrician-41503

10/08/2020, 2:50 AM
Thanks for quickly pointing this out. I missed it and it would have probably taken me time to find the doc
b

billowy-army-68599

10/08/2020, 3:03 AM
for s3 buckets specifically, there's a
bucket
argument which will specify the name for you: https://www.pulumi.com/docs/reference/pkg/nodejs/pulumi/aws/s3/#BucketArgs-bucket
q

quaint-electrician-41503

10/08/2020, 4:36 AM
I went ahead and am using the number appended name. How do I get the uri for the created bucket so I can pass it along as a string, via python? I am passing it as a template parameter but I see
pulumi.ouput.Output object at 0x2045...
instead of the name using bucket as an argument
I think the type is Output[String]...
Sorry for my lack of better knowledge
g

gentle-diamond-70147

10/08/2020, 5:00 AM
If you're needing to take the bucket URI and render it within a template, you need to interpolate the resource output. https://www.pulumi.com/docs/intro/concepts/programming-model/#outputs-and-strings
q

quaint-electrician-41503

10/08/2020, 5:21 AM
I tried doing something like values = bucked.id.apply(lambda x: yaml.load(Environment(...).get_template('...').render(uri=x))
and then using that like I did previously before just passing the string around. However I think wrapping up in the apply method that yaml loading my template it's not kosher
Got a template not found exception. I'm currently using jinja. It might be pretty ghetto since I think maybe there is a built in templating functionality
g

gentle-diamond-70147

10/08/2020, 3:26 PM
Here's a similar use case in Go, but hopefully gives you a good enough example - https://gist.github.com/clstokes/7d065009cd048388cd981d37db2c5f48#file-main-go-L37-L67. Essentially you need to do the rendering within the
apply
call.
👀 1
q

quaint-electrician-41503

10/08/2020, 6:10 PM
I was using jinja templates to keep the yaml helm chart I'm loading external so it doesn't clobber my application. But I think loading the template from the filesystem is causing the issue. I tried to move the loading into the
apply
call, but I get a template not found exception.
The template loading was working well before I tried to work with provisioning an S3 bucket
I'm a little hard pressed to keep the helm chart configuration template outside of my program and as an external resource, because I want to separate the configuration from the program. I'd also like to IE be able to easily read the helm chart and provision externally
So I tried
bucked.id.apply(lambda x: yaml.load(Environment(...).get_template('...').render(uri=x))
as above and also similar but adding the jinja FileSystemLoader into this
id.apply
also.
@gentle-diamond-70147 I looked at your reply and think I'm trying something similar but I made a mention in the python channel. Still haven't figured it out but thought if I provide more code it would become apparent to someone more seasoned: https://pulumi-community.slack.com/archives/CDE799L1M/p1602226841058700
g

gentle-diamond-70147

10/09/2020, 4:24 PM
Can you provide your full application code? I'm having trouble understanding what you're trying and how it's not working for you.
q

quaint-electrician-41503

10/09/2020, 10:17 PM
Hi @gentle-diamond-70147 what I found out was I had exported some part of the kubernetes cluster and that was causing the exception. The code is working. Thanks for your help!