I am trying to import an existing S3 object into Pulumi. This is my current attempt (using Python):
bucket = s3.Bucket('test-bucket',
bucket='test-bucket')
file = s3.BucketObject('file.txt',
bucket=bucket,
key='temp/file.txt',
opts=ResourceOptions(import_='temp/file.txt'))
With that config, I am getting the following error:
Diagnostics:
aws:s3:BucketObject (file.txt):
error: Preview failed: refreshing urn:pulumi:dev::quickstart::aws:s3/bucketObject:BucketObject::file.txt: 1 error occurred:
* InvalidParameter: 2 validation error(s) found.
- minimum field size of 1, HeadObjectInput.Bucket.
- minimum field size of 1, HeadObjectInput.Key.
I could not find any mention of a HeadObjectInput
in the reference documentation.
What parameters should I pass to BucketObject()
so that the S3 object is imported in Pulumi?
My final goal here is to use Pulumi to delete an existing object from an S3 bucket. Is there any other way for achieving this?
Currently, the Pulumi aws provider is built on the terraform aws provider. So, I tried importing an S3 bucket and S3 bucket object in terraform. Although the bucket imports in terraform (and Pulumi), terraform throws an error:
Therefore, the Pulumi provider (at this time) does not support it either.