-
Notifications
You must be signed in to change notification settings - Fork 432
Description
This is a proposal to fix issue #1975 regarding the ability to create environment-specific resources. These resources would be shared across all services.
An _addons
subdirectory containing environment add-ons would be created in the copilot
directory. This would contain addons that apply to all environments. To specify an addon for a specific environment, a subdirectory named after the environment would be created.
Example:
<project-root>
|- copilot/
|- _addons/
|- addon-1.yml
|- addon-2.yml
|- dev/
|- dev-addon-1.yml
|- prod/
|- prod-addon-1.yml
|- service1/
|- addons/
|- service-addon-1.yml
|- manifest.yml
Environment resources would be created automatically when the first service is deployed. For a specific environment, all relevant add-ons would be merged into a unique CF stack, deployed before the service add-ons stack.
Considering the example above, the copilot svc deploy -e dev -n service1
would execute the following steps:
- The environment add-ons CF stack, containing
addon-1.yml
,addon-2.yml
anddev-addon-1.yml
, is deployed. - The
service1
add-ons CF stack, containingservice-addon-1.yml
, is deployed as usual. - The
service1
CF stack is deployed as usual.
Environment add-ons resources would be deleted only when the environment itself is deleted.
This solution seems to nicely integrate in the current copilot workflow. Some commands could be added in the future (like copilot env update
) to improve upon this solution.
I am proposing this with @rverpillot and we are reasonably confident to be able to propose a PR, so feel free to criticize and improve upon this idea. Obviously, we'll start working on this only if approved by the team. Thanks !