Skip to content

Commit

Permalink
fix: Support Condition attribute in resources.extensions (#8217)
Browse files Browse the repository at this point in the history
  • Loading branch information
glb committed Sep 10, 2020
1 parent 7c698bd commit 16bae33
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/providers/aws/guide/resources.md
Expand Up @@ -127,6 +127,7 @@ Here's how the extension logic is defined:

| Resource attribute | Operation |
| --------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| `Condition` | Set to extension value if present. |
| `CreationPolicy` | Set to extension value if present. |
| `DeletionPolicy` | Set to extension value if present. |
| `DependsOn` | Merge. The extension value will be added to the resource's `DependsOn` list. |
Expand Down
Expand Up @@ -34,6 +34,7 @@ module.exports = {
}

switch (extensionAttributeName) {
case 'Condition':
case 'CreationPolicy':
case 'DeletionPolicy':
case 'UpdatePolicy':
Expand Down
Expand Up @@ -217,6 +217,7 @@ describe('mergeCustomProviderResources', () => {
it('should overwrite for resources.extensions.*.{CreationPolicy,DeletionPolicy,UpdatePolicy,UpdateReplacePolicy}', () => {
awsPackage.serverless.service.provider.compiledCloudFormationTemplate.Resources = {
SampleResource: {
Condition: 'Condition',
CreationPolicy: {
AutoScalingCreationPolicy: {
MinSuccessfulInstancesPercent: 10,
Expand All @@ -242,6 +243,7 @@ describe('mergeCustomProviderResources', () => {
awsPackage.serverless.service.resources = {
extensions: {
SampleResource: {
Condition: 'New',
CreationPolicy: {
ResourceSignal: {
Count: 3,
Expand All @@ -260,6 +262,7 @@ describe('mergeCustomProviderResources', () => {
awsPackage.serverless.service.provider.compiledCloudFormationTemplate.Resources
.SampleResource
).to.deep.equal({
Condition: 'New',
CreationPolicy: {
ResourceSignal: {
Count: 3,
Expand Down

0 comments on commit 16bae33

Please sign in to comment.