forked from aws/aws-cdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cfn-include): add support for the DependsOn attribute
DependsOn is modeled in the CDK L1s as references to the actual object instances. To make it possible to get those references from inside the fromCloudFormation static methods of the L1 classes that are used in the CfnInclude, add a new interface to @aws-cdk/core, ICfnFinder, as a 4th parameter to the fromCloudFormation method (wrapped in an Options interface for future-proofing) that serves as a callback to find the L1 object instance with the given logical ID. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information
Showing
10 changed files
with
130 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
.../@aws-cdk/cloudformation-include/test/test-templates/invalid/non-existent-depends-on.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"Resources": { | ||
"Bucket2": { | ||
"Type": "AWS::S3::Bucket", | ||
"Properties": { | ||
"BucketName": "bucket2" | ||
}, | ||
"DependsOn": "Bucket1" | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
...s-cdk/cloudformation-include/test/test-templates/resource-attribute-depends-on-array.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"Resources": { | ||
"Bucket0": { | ||
"Type": "AWS::S3::Bucket" | ||
}, | ||
"Bucket1": { | ||
"Type": "AWS::S3::Bucket" | ||
}, | ||
"Bucket2": { | ||
"Type": "AWS::S3::Bucket", | ||
"Properties": { | ||
"BucketName": "bucket2" | ||
}, | ||
"DependsOn": ["Bucket0", "Bucket1"] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { CfnResource } from './cfn-resource'; | ||
|
||
/** | ||
* An interface that represents callbacks into a CloudFormation template. | ||
* Used by the fromCloudFormation methods in the generated L1 classes. | ||
* | ||
* @experimental | ||
*/ | ||
export interface ICfnFinder { | ||
/** | ||
* Returns the resource with the given logical ID in the template. | ||
* If a resource with that logical ID was not found in the template, | ||
* returns undefined. | ||
*/ | ||
findResource(logicalId: string): CfnResource | undefined; | ||
} | ||
|
||
/** | ||
* The interface used as the last argument to the fromCloudFormation | ||
* static method of the generated L1 classes. | ||
* | ||
* @experimental | ||
*/ | ||
export interface FromCloudFormationOptions { | ||
/** | ||
* The finder interface used to resolve references across the template. | ||
*/ | ||
readonly finder: ICfnFinder; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters