Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws-s3-deployment: Conditional BucketDeployment #28602

Open
2 tasks
vs-amzn opened this issue Jan 6, 2024 · 3 comments
Open
2 tasks

aws-s3-deployment: Conditional BucketDeployment #28602

vs-amzn opened this issue Jan 6, 2024 · 3 comments
Labels
@aws-cdk/aws-s3-deployment effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2

Comments

@vs-amzn
Copy link

vs-amzn commented Jan 6, 2024

Describe the feature

Similar to how we can use a CfnCondition for s3.Bucket creation, was thinking this could be a good use case for BucketDeployment as well. Basically pass in an additional param condition: CfnCondition and depending on the condition, the assets will/will not be deployed to the bucket.

Use Case

Originally would like to conditionally deploy based off of what's currently deployed in s3 (ex] if object[x] === true, don't deploy. else deploy). So was thinking of using CfnOutputs and was trying to conditionally deploy to s3 based on the value of CfnOutput in a separate stack but it seems like this is not possible.

Proposed Solution

No response

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.60.0

Environment details (OS name and version, etc.)

NodeJS 18, Typescript

@vs-amzn vs-amzn added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Jan 6, 2024
@vs-amzn
Copy link
Author

vs-amzn commented Jan 8, 2024

Was thinking of creating a CfnCustomResource (which is of type CfnResource and inherently has the cfnOptions.condition property). This would be a wrapper to create a BucketDeployment. So if the cfnOptions.condition evaluates to false, the CfnCustomResource wouldn't be deployed and in turn the BucketDeployment wouldn't deploy either. If true, it would deploy an update.

@pahud
Copy link
Contributor

pahud commented Jan 8, 2024

I am not sure if it's a good idea to expose that property in the L2 but you can always do that by yourself by finding the L1 resource and override the its condition property.

@pahud pahud added p2 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Jan 8, 2024
@vs-amzn
Copy link
Author

vs-amzn commented Jan 8, 2024

Would CfnCustomResource be considered an L1 resource?

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-s3-deployment effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

No branches or pull requests

2 participants