File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
packages/aws-cdk-lib/aws-cloudfront Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -279,13 +279,15 @@ export class EdgeFunction extends Resource implements lambda.IVersion {
279279 }
280280
281281 const edgeStackId = stackId ?? `edge-lambda-stack-${ this . stack . node . addr } ` ;
282+ const parentStack = Stack . of ( this ) ;
282283 let edgeStack = stage . node . tryFindChild ( edgeStackId ) as Stack ;
283284 if ( ! edgeStack ) {
284285 edgeStack = new Stack ( stage , edgeStackId , {
285286 env : {
286287 region : EdgeFunction . EDGE_REGION ,
287288 account : Stack . of ( this ) . account ,
288289 } ,
290+ tags : parentStack . tags . tagValues ( ) ,
289291 } ) ;
290292 }
291293 this . stack . addDependency ( edgeStack ) ;
Original file line number Diff line number Diff line change @@ -110,6 +110,25 @@ describe('stacks', () => {
110110 expect ( fnStack . account ) . toEqual ( '111111111111' ) ;
111111 } ) ;
112112
113+ test ( 'us-east-1 stack inherits tags of parent stack' , ( ) => {
114+ stack = new cdk . Stack ( app , 'StackWithDefaultAccount' , {
115+ env : { region : 'testregion' } ,
116+ tags : {
117+ abc : 'def' ,
118+ } ,
119+ } ) ;
120+
121+ new cloudfront . experimental . EdgeFunction (
122+ stack ,
123+ 'MyFn' ,
124+ defaultEdgeFunctionProps ( ) ,
125+ ) ;
126+
127+ const fnStack = getFnStack ( ) ;
128+
129+ expect ( fnStack . tags . tagValues ( ) ) . toEqual ( { abc : 'def' } ) ;
130+ } ) ;
131+
113132 test ( 'us-east-1 stack inherits account of parent stack, when parent stack account is undefined' , ( ) => {
114133 stack = new cdk . Stack ( app , 'StackWithDefaultAccount' , {
115134 env : { region : 'testregion' } ,
You can’t perform that action at this time.
0 commit comments