@@ -92,7 +92,7 @@ type DatabaseService = {
9292 serviceName: string ;
9393 dbName: pulumi .Input <string >;
9494 username: pulumi .Input <string >;
95- password: pulumi .Input <string >;
95+ password? : pulumi .Input <string >;
9696 applyImmediately? : pulumi .Input <boolean >;
9797 skipFinalSnapshot? : pulumi .Input <boolean >;
9898 allocatedStorage? : pulumi .Input <number >;
@@ -131,7 +131,7 @@ export type WebServerService = {
131131 environment? :
132132 | aws .ecs .KeyValuePair []
133133 | ((services : Services ) => aws .ecs .KeyValuePair []);
134- secrets? : aws .ecs .Secret [];
134+ secrets? : aws .ecs .Secret [] | (( services : Services ) => aws . ecs . Secret []) ;
135135 image: pulumi .Input <string >;
136136 port: pulumi .Input <number >;
137137 domain: pulumi .Input <string >;
@@ -203,6 +203,33 @@ const project = new studion.Project('demo-project', {
203203});
204204```
205205
206+ ``` ts
207+ const project = new studion .Project (' demo-project' , {
208+ environment: ' DEVELOPMENT' ,
209+ services: [
210+ {
211+ type: ' REDIS' ,
212+ serviceName: ' redis' ,
213+ dbName: ' test-db' ,
214+ },
215+ {
216+ type: ' WEB_SERVER' ,
217+ serviceName: ' api' ,
218+ image: imageUri ,
219+ port: 3000 ,
220+ domain: ' api.my-domain.com' ,
221+ secrets : (services : Services ) => {
222+ const redisServiceName = ' redis' ;
223+ const redis = services [redisServiceName ];
224+ return [
225+ { name: ' REDIS_PASSWORD' , valueFrom: redis .passwordSecret .arn },
226+ ];
227+ },
228+ },
229+ ],
230+ });
231+ ```
232+
206233### Database
207234
208235AWS RDS Postgres instance.
@@ -229,8 +256,8 @@ new Database(name: string, args: DatabaseArgs, opts?: pulumi.CustomResourceOptio
229256type DatabaseArgs = {
230257 dbName: pulumi .Input <string >;
231258 username: pulumi .Input <string >;
232- password: pulumi .Input <string >;
233259 vpc: awsx .ec2 .Vpc ;
260+ password? : pulumi .Input <string >;
234261 applyImmediately? : pulumi .Input <boolean >;
235262 skipFinalSnapshot? : pulumi .Input <boolean >;
236263 allocatedStorage? : pulumi .Input <number >;
@@ -242,6 +269,10 @@ type DatabaseArgs = {
242269};
243270```
244271
272+ If a password is not specified, it will be autogenerated and stored as a secret
273+ inside AWS Secret Manager. The secret will be available on the ` Database ` resource
274+ as ` passwordSecret ` .
275+
245276### Redis
246277
247278[ Upstash] ( https://upstash.com ) Redis instance.
@@ -283,6 +314,9 @@ interface RedisOptions extends pulumi.ComponentResourceOptions {
283314}
284315```
285316
317+ After creating the Redis resource, the ` passwordSecret ` AWS Secret Manager Secret
318+ will exist on the resource.
319+
286320### Static Site
287321
288322AWS S3 + Cloudfront static site.
@@ -467,4 +501,3 @@ const project = new studion.Project('demo-project', {
467501
468502- [ ] Add worker service for executing tasks
469503- [ ] Add MongoDB service
470- - [ ] Make db username & password fields optional and autogenerate db username & password if they are not provided
0 commit comments