Repository: aws-cloudformation/cfn-lint

Issue:
`EnableVersionUpgrade` Update Policy Not Recognized
*cfn-lint version: (`cfn-lint --version`)* 0.25.5

*Description of issue:*

cfn-lint does not understand `AWS::Elasticsearch::Domain`'s new `UpdatePolicy` of `EnableVersionUpgrade`. This key accepts a Boolean value.

> If `EnableVersionUpgrade` is set to true, you can update the `ElasticsearchVersion` property of the `AWS::Elasticsearch::Domain` resource, and CloudFormation will update that property without interruption. When `EnableVersionUpgrade` is set to `false`, or not specified, updating the `ElasticsearchVersion` property results in CloudFormation replacing the entire `AWS::Elasticsearch::Domain` resource.

I have a patch for this ready to go, and the PR should be created in a couple of minutes.



Discussion:

Resolving patch:
diff --git a/src/cfnlint/rules/resources/updatepolicy/Configuration.py b/src/cfnlint/rules/resources/updatepolicy/Configuration.py
--- a/src/cfnlint/rules/resources/updatepolicy/Configuration.py
+++ b/src/cfnlint/rules/resources/updatepolicy/Configuration.py
@@ -91,6 +91,12 @@ class Configuration(CloudFormationLintRule):
                     'AWS::Lambda::Alias'
                 ]
             },
+            'EnableVersionUpgrade': {
+                'PrimitiveType': 'Boolean',
+                'ResourceTypes': [
+                    'AWS::Elasticsearch::Domain'
+                ]
+            },
             'UseOnlineResharding': {
                 'PrimitiveType': 'Boolean',
                 'ResourceTypes': [


Test patch:
diff --git a/test/fixtures/templates/bad/resources/updatepolicy/config.yaml b/test/fixtures/templates/bad/resources/updatepolicy/config.yaml
--- a/test/fixtures/templates/bad/resources/updatepolicy/config.yaml
+++ b/test/fixtures/templates/bad/resources/updatepolicy/config.yaml
@@ -25,7 +25,7 @@ Resources:
       MinSize: '1'
     UpdatePolicy:
       AutoScalingScheduledAction:
-        IgnoreUnmodifiedGroupSizeProperties: 'true' # invalide type
+        IgnoreUnmodifiedGroupSizeProperties: 'true' # invalid type
       AutoScalingRollingUpdate:
         MinInstancesInService: '1' # invalide type
         MaxBatchSize: '2' # invalide type
@@ -130,3 +130,11 @@ Resources:
     Properties:
       MinSize: '1'
       MaxSize: '1'
+  ESD1:
+    Type: AWS::Elasticsearch::Domain
+    UpdatePolicy:
+      AutoScalingReplacingUpdate: true # wrong property name
+  ESD2:
+    Type: AWS::Elasticsearch::Domain
+    UpdatePolicy:
+      EnableVersionUpgrade: 'true' # invalid type
diff --git a/test/fixtures/templates/good/resources/updatepolicy/config.yaml b/test/fixtures/templates/good/resources/updatepolicy/config.yaml
--- a/test/fixtures/templates/good/resources/updatepolicy/config.yaml
+++ b/test/fixtures/templates/good/resources/updatepolicy/config.yaml
@@ -79,3 +79,11 @@ Resources:
     Properties:
       MinSize: '1'
       MaxSize: '1'
+  ESD1:
+    Type: AWS::Elasticsearch::Domain
+    UpdatePolicy:
+      EnableVersionUpgrade: false
+  ESD2:
+    Type: AWS::Elasticsearch::Domain
+    UpdatePolicy:
+      EnableVersionUpgrade: true
diff --git a/test/unit/rules/resources/updatepolicy/test_configuration.py b/test/unit/rules/resources/updatepolicy/test_configuration.py
--- a/test/unit/rules/resources/updatepolicy/test_configuration.py
+++ b/test/unit/rules/resources/updatepolicy/test_configuration.py
@@ -24,4 +24,4 @@ def test_file_positive(self):
     def test_file_negative_alias(self):
         """Test failure"""
         self.helper_file_negative(
-            'test/fixtures/templates/bad/resources/updatepolicy/config.yaml', 11)
+            'test/fixtures/templates/bad/resources/updatepolicy/config.yaml', 14)