copilot-cli icon indicating copy to clipboard operation
copilot-cli copied to clipboard

Support for excluding environment addons

Open al-dpopowich opened this issue 11 months ago • 0 comments

I'm finding myself wanting a higher level of abstraction on conditional exclusion of Environment level addons.

Use case: we use RDS for our beta and production sites, but for short-lived feature branches used for demos and QA we prefer not to have the complexity or expense of RDS, instead preferring a postgresql container.

For example, using copilot storage init to create a RDS addon creates 9 resources and 2 outputs in the yaml patch. To exclude these resources you have to create a Conditions section then edit every Resource and Output adding a Condition, which is tedious and error prone:

Conditions:
   IsProduction: !Equals [!Ref Env, prod]
   IsBeta: !Equals [!Ref Env, beta]
   CreateRDS: !Or [!Condition IsProduction, !Condition IsBeta]

Resources:
   fooclusterDBSubnetGroup:
      Condition: CreateRDS
      ...

   fooclusterWorkloadSecurityGroup:
      Condition: CreateRDS
      ...

   fooclusterDBClusterSecurityGroup:
      Condition: CreateRDS
      ...

   ...

Outputs:
   fooclusterSecret:
      Condition: CreateRDS
      ...

   fooclusterSecurityGroup:
      Condition: CreateRDS
      ...

Feature request: add an exclude_addons property to the Environment manifest which is an array of file names in the copilot/environments/addons/ directory, e.g.:

# feature-branch Environment

name: feature
type: Environment

exclude_addons:
   # do not include RDS for feature branches
   - foo-cluster.yml

al-dpopowich avatar Mar 08 '24 18:03 al-dpopowich