Conditionally add Outputs from addons to the main stack
As a Copilot user, I don't want it to create an addons stack at all for production environment. Is it possible to create an addons stack conditionally.
Right now users can do git branch switch to control if the addons file is there or not as a workaround.
Here is a sample addon template for this usecase: https://gist.github.com/ColeDCrawford/d40cc0887226867f48d199d27572c743
Where a client has already existing infrastructure in the "prod" environment, and would like to only create resources in the "test" environment.
One workaround that I can think of that's not super ugly is writing something like this in the Outputs:
Outputs:
mcihdevclusterSecret: # injected as MCIHDEVCLUSTER_SECRET environment variable by Copilot.
Value: !If [CreateDevResources, !Ref mcihdevclusterAuroraSecret, 'arn:aws:secretsmanager:us-west-2:111122223333:secret:aes128-1a2b3c'] # where the else statement is the secret value in "prod"
This way we remove any Condition to create the Output and instead change the Value of the Output based on the condition.