Repository: aws-cloudformation/cfn-lint

Issue:
Support for multiple CodePipeline OutputArtifacts
*cfn-lint version*: 0.12.1

*Description of issue.*

The CloudFormation linter does not yet support having multiple values for the OutputArtifacts property. When linting a template it gives the following error message:
`E2541 Action "CodeBuild" declares 2 OutputArtifacts which is not in expected range [0, 1].`

```yaml
---
AWSTemplateFormatVersion: 2010-09-09
Resources:
  Pipeline:
    Type: AWS::CodePipeline::Pipeline
    Properties:
      Name: pipeline
      RoleArn: 'rolearn'
      RestartExecutionOnUpdate: true
      ArtifactStore:
        Location: 'artifactbucket'
        Type: S3
      Stages:
        - Name: Source
          Actions:
            - Name: SourceRepo
              ActionTypeId:
                # More info on Possible Values: https://docs.aws.amazon.com/codepipeline/latest/userguide/reference-pipeline-structure.html#action-requirements
                Category: Source
                Owner: ThirdParty
                Provider: GitHub
                Version: "1"
              Configuration:
                Owner: '{{resolve:ssm:/service/github/owner:1}}'
                OAuthToken: '{{resolve:ssm:/service/github/token:3}}'
                Repo: 'repo'
                Branch: 'develop'
                PollForSourceChanges: true
              OutputArtifacts:
                - Name: source
              RunOrder: 1
        - Name: Build
          Actions:
            - Name: CodeBuild
              ActionTypeId:
                Category: Build
                Owner: AWS
                Provider: CodeBuild
                Version: "1"
              Configuration:
                ProjectName: 'codebuildproject'
              InputArtifacts:
                - Name: source
              OutputArtifacts:
                - Name: artifact1
                - Name: artifact2 # this goes wrong
              RunOrder: 1
```

As additional information a [blog post](https://aws.amazon.com/about-aws/whats-new/2018/08/aws-codebuild-adds-ability-to-create-build-projects-with-multiple-input-sources-and-output-artifacts/) about the release of support for this and the [CloudFormation spec](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codepipeline-pipeline-stages-actions.html).


Discussion:

Resolving patch:
diff --git a/src/cfnlint/rules/resources/codepipeline/CodepipelineStageActions.py b/src/cfnlint/rules/resources/codepipeline/CodepipelineStageActions.py
--- a/src/cfnlint/rules/resources/codepipeline/CodepipelineStageActions.py
+++ b/src/cfnlint/rules/resources/codepipeline/CodepipelineStageActions.py
@@ -40,12 +40,6 @@ class CodepipelineStageActions(CloudFormationLintRule):
                     'OutputArtifactRange': 1,
                 }
             },
-            'Build': {
-                'CodeBuild': {
-                    'InputArtifactRange': 1,
-                    'OutputArtifactRange': (0, 1),
-                },
-            },
             'Test': {
                 'CodeBuild': {
                     'InputArtifactRange': 1,


Test patch:
diff --git a/test/fixtures/templates/bad/resources_codepipeline_action_artifact_counts.yaml b/test/fixtures/templates/bad/resources_codepipeline_action_artifact_counts.yaml
--- a/test/fixtures/templates/bad/resources_codepipeline_action_artifact_counts.yaml
+++ b/test/fixtures/templates/bad/resources_codepipeline_action_artifact_counts.yaml
@@ -37,4 +37,23 @@ Resources:
                 ProjectName: cfn-python-lint
               InputArtifacts:
               - Name: MyApp
-              - Name: MyApp2
+              - Name: MyApp2  # No Longer an error
+              OutputArtifacts:
+              - Name: MyOutput1
+              - Name: MyOutput2  # No Longer an error
+        - Name: MyApprovalStage
+          Actions:
+            - Name: MyApprovalAction
+              ActionTypeId:
+                Category: Approval
+                Owner: AWS
+                Version: "1"
+                Provider: Manual
+              InputArtifacts:
+              - Name: MyApp # Error
+              OutputArtifacts:
+              - Name: MyOutput1 # Error
+              Configuration:
+                NotificationArn: arn:aws:sns:us-east-2:80398EXAMPLE:MyApprovalTopic
+                ExternalEntityLink: http://example.com
+                CustomData: The latest changes include feedback from Bob.
diff --git a/test/rules/resources/codepipeline/test_stageactions.py b/test/rules/resources/codepipeline/test_stageactions.py
--- a/test/rules/resources/codepipeline/test_stageactions.py
+++ b/test/rules/resources/codepipeline/test_stageactions.py
@@ -31,7 +31,7 @@ def test_file_positive(self):
 
     def test_file_artifact_counts(self):
         """Test failure"""
-        self.helper_file_negative('test/fixtures/templates/bad/resources_codepipeline_action_artifact_counts.yaml', 1)
+        self.helper_file_negative('test/fixtures/templates/bad/resources_codepipeline_action_artifact_counts.yaml', 2)
 
     def test_file_invalid_owner(self):
         """Test failure"""