AWS S3 BucketDeployment zip file name for CodePipeline Issue

36 Views Asked by At

I am using AWS CDK BucketDeployment resource to upload a zipped folder to S3 and then pass it as a parameter to a S3SourceAction for CodePipeline. Unfortunately this zipped folder gets assigned a random name such as 67054430768174012aa52e1e99cd5b2ea610ac74de4ef65205dbe42d7f070532f1382_asset.6705421942432aa52e1e99cd5b2ea610ac74de4ef65205dbe42d7f07a3fnb72952.zip

How can I retrieve the name of the file as a string and pass it to the bucketKey in S3SourceAction? I tried getting the file name like this:

const zippedConfigsDir: string = Fn.select(0, searchyBucketDeployments.objectKeys)

But that returns the filename along with the extra prefix local_development_resources_transform/cdk.out that I can't get rid of.

local_development_resources_transform/cdk.out/.zip

Here is my code:

const testBucketDeployments = new BucketDeployment(this, 'test-ConfigBackups', {

  sources: [Source.asset(resolve(__dirname, '../../splunk_config_files'))],

  destinationBucket: bucketConfigFiles,

  extract: false,

});



const zippedConfigsDir: string = Fn.select(0, searchyBucketDeployments.objectKeys)



const sourceAction = new S3SourceAction({

  actionName: 'S3ConfigSource',

  bucket: bucketConfigFiles,

  bucketKey: zippedConfigsDir,

  output: sourceOutput,

  role: codeDeployRole,

});

How can I get just the name of the zipped file being created by testBucketDeployments?

0

There are 0 best solutions below