https://pulumi.com logo
Title
g

great-sunset-355

06/22/2021, 10:30 AM
Hi, is there a way to preserve a bucket object? I'm trying to replicate behaviour of
eb cli
that zips and uploads the app directory to S3 bucket and references that to EB environment When I use this with
pulumi
it will manage the object and when it changes it deletes the old one and uploads a new version instead of preserving the old object. Do I need to write my own function with aws sdk to zip the file and upload or can pulumi do that for me? Thank you
eb_app_archive = s3.BucketObject(
        f"app-archive-{ver}",
        bucket=eb_s3_bucket.id,
        key=f"jan-{ver}.zip",
        source=pulumi.FileArchive("../app"),
    )
b

brave-planet-10645

06/22/2021, 10:33 AM
So you want to keep the old versions there as well as uploading the new ones?
g

great-sunset-355

06/22/2021, 12:03 PM
yes, that would be desired
I'm also having troubles making beanstalk to accept new version from pulumi
b

brave-planet-10645

06/22/2021, 1:12 PM
So the idea of Pulumi is that it describes what your end-state should be. So if you want multiple versions available, you're going to have to loop through your local directory and create multiple
BucketObject
resources
The same with the beanstalk. It'll create the new version and then delete the old one
g

great-sunset-355

06/22/2021, 1:18 PM
so I guess that another solution is to write a function that uploads file to S3 and tells pulumi to take S3 key when changing
ApplicationVersion
object which should trigger environment version change as well