aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.51k stars 3.85k forks source link

AppConfig: Get latest deployed configuration #29162

Open 0xBradock opened 7 months ago

0xBradock commented 7 months ago

Describe the feature

Add a command to AppConfig to retrieve a deployed configuration during CDK synthesize step.

Use Case

I have a CDK application that deploys stacks like this:

const clients = [/*...*/]

clients.forEach( client => new ClientShop(app, `${client.name}-shop`, { client } ) )

Problem

For now clients is an array stored in code. The clients information is managed by another team. So, every time they want to modify it, they need to open a ticket.

Goal

I want to give them the ability to edit themselves the information of client using an AWS resource. This will allow me to change the CDK application to this:

//                              šŸ‘‡
const clients = new GetClientsFromConfig(app, 'config')

clients.forEach( client => new ClientShop(app, `${client.name}-shop`, { client } ) )

This would separate the logic from data with a good user experience.

Proposed Solution

One option would be to implement it similar to the static method SSM fromStringParameterAttributes.

Other Information

Options I considered to deploy the clients and read from GetClientsFromConfig:

I am still open to other solutions, if they exist. But, as far as I gather AppConfig would be the best alternative.

Acknowledgements

CDK version used

2.128.0

Environment details (OS name and version, etc.)

MacOS Apple M1 Pro

pahud commented 6 months ago

I want to give them the ability to edit themselves the information of client using an AWS resource.

Where would you like the information to be stored in AWS resource? Parameter store? Traditionally such information should be stored in the git repository as plain text configs or objects in S3 buckets and you can fetch them in your CDK code and pass to your constructs so we don't have to hack that in the L2 constructs. But this deserves more discussion here with the community.

0xBradock commented 6 months ago

Yes, using S3 would be easy. But, what I need is to provide an easy interface with validation to non-technical colleagues to configure a CDK application with free-form or feature flags. AppConfig provides exactly that, but for running applications. I need that same functionality during CDK synthesize step.