11import * as ros from '@alicloud/ros-cdk-core' ;
2+ import { RosParameterType } from '@alicloud/ros-cdk-core' ;
23import * as fc from '@alicloud/ros-cdk-fc' ;
34import * as agw from '@alicloud/ros-cdk-apigateway' ;
45import * as ram from '@alicloud/ros-cdk-ram' ;
@@ -23,7 +24,15 @@ export class IacStack extends ros.Stack {
2324 return acc ;
2425 } , { } ) ,
2526 } ) ;
26- console . log ( 'tags' , iac . tags ) ;
27+
28+ Object . entries ( iac . vars ) . map (
29+ ( [ key , value ] ) =>
30+ new ros . RosParameter ( this , key , {
31+ type : RosParameterType . STRING ,
32+ defaultValue : value ,
33+ } ) ,
34+ ) ;
35+
2736 new ros . RosInfo ( this , ros . RosInfo . description , `${ iac . service } stack` ) ;
2837
2938 const service = new fc . RosService (
@@ -153,23 +162,17 @@ const generateStackTemplate = (stackName: string, iac: ServerlessIac, context: A
153162
154163 const assembly = app . synth ( ) ;
155164 const stackArtifact = assembly . getStackByName ( stackName ) ;
156- const parameters = Object . entries ( stackArtifact . parameters ) . map ( ( [ key , value ] ) => ( {
157- key,
158- value,
159- } ) ) ;
160165
161- return { template : stackArtifact . template , parameters } ;
166+ return { template : stackArtifact . template } ;
162167} ;
163168
164169export const deployStack = async (
165170 stackName : string ,
166171 iac : ServerlessIac ,
167172 context : ActionContext ,
168173) => {
169- printer . info ( `Deploying stack... ${ JSON . stringify ( iac ) } ` ) ;
170-
171- const { template, parameters } = generateStackTemplate ( stackName , iac , context ) ;
172- console . log ( 'Generated ROS YAML:' , JSON . stringify ( { template, parameters } ) ) ;
173- await rosStackDeploy ( stackName , template , { ...context , parameters } ) ;
174+ const { template } = generateStackTemplate ( stackName , iac , context ) ;
175+ console . log ( 'Generated ROS YAML:' , JSON . stringify ( { template } ) ) ;
176+ await rosStackDeploy ( stackName , template , context ) ;
174177 printer . info ( `Stack deployed! 🎉` ) ;
175178} ;
0 commit comments