@@ -183,54 +183,7 @@ async function getLambdasInStack(
183183 return allLambdas ;
184184}
185185
186- /**
187- * Get CloudFormation stack template
188- * @param stackName
189- * @param awsConfiguration
190- * @returns
191- */
192- async function getStackResourcePhysicalResourceId (
193- stackName : string ,
194- logicalResourceId : string ,
195- awsConfiguration : AwsConfiguration ,
196- ) {
197- const { DescribeStackResourceCommand } = await import (
198- '@aws-sdk/client-cloudformation'
199- ) ;
200- const command = new DescribeStackResourceCommand ( {
201- StackName : stackName ,
202- LogicalResourceId : logicalResourceId ,
203- } ) ;
204- const cloudFormationClient = await getCloudFormationClient ( awsConfiguration ) ;
205-
206- try {
207- const response = await cloudFormationClient . send ( command ) ;
208-
209- if ( ! response . StackResourceDetail ) {
210- throw new Error (
211- `No resource details found in stack ${ stackName } for ${ logicalResourceId } ` ,
212- ) ;
213- }
214-
215- const physicalResourceId = response . StackResourceDetail . PhysicalResourceId ;
216- if ( ! physicalResourceId )
217- throw new Error (
218- `No physicalResourceId found in stack ${ stackName } for ${ logicalResourceId } ` ,
219- ) ;
220- return physicalResourceId ;
221- } catch ( error : any ) {
222- if ( error . name === 'ValidationError' ) {
223- Logger . error (
224- `Stack ${ stackName } and/or ${ logicalResourceId } not found. Try specifying a region. Error: ${ error . message } ` ,
225- error ,
226- ) ;
227- }
228- throw error ;
229- }
230- }
231-
232186export const CloudFormation = {
233187 getCloudFormationStackTemplate,
234188 getLambdasInStack,
235- getStackResourcePhysicalResourceId : getStackResourcePhysicalResourceId ,
236189} ;
0 commit comments