cdklabs / cdk-docker-image-deployment

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature Request: Reuse Infrastructure that Supports CodeBuild (lambdas, iam roles, provider, custom resource)

scanlonp opened this issue · comments

Each time the construct is instantiated, a custom resource, provider, 2 lambdas, and all of their roles are partitioned. Is there a way to reuse some of these resources? This may allow these resources to be pre-created and stored in a separate stack that is then referenced as a dependency.

  • An option to use a pre-existing provider, lambdas, and roles that can be fed into a custom resource unique to each construct
    • would there be an issue granting permissions to run CodeBuild API calls to those pre-existing roles (I do not think so)
  • An option to use any combination of those pre-existing resources
    • for example: pass in the lambdas, but need roles and provider and custom resource created

Thank you @fjinkis for bringing up this request!

@fjinkis I completely agree that the construct is quite resource heavy. The main justification is that it creates a dependency on the CodeBuild finishing moving the image before allowing any other action by the stack (or other stacks that depend on it) to continue. While it benefits from avoiding race conditions and giving better error messaging, it takes up time and creates a lot of surrounding infrastructure.

I think the most sharing the construct can do would be reusing everything that goes into the custom resource but not the custom resource itself. That is not supported yet, but I think would be an easy improvement.

Another idea (which may justify a new issue) is to add an option to not wait on the CodeBuild and only make a custom resource that starts it. That would be much more light weight and a lot faster, but would not provide the same guardrails.