mbj / stratosphere

Haskell EDSL and type-checker for AWS CloudFormation templates
MIT License
162 stars 19 forks source link

CodeBuildProjectTriggersFilterGroups should be list of lists #140

Closed dmateusp closed 1 year ago

dmateusp commented 5 years ago

Hi there, stratosphere seems to have a wrong spec here:

AWS Cloudformation docs FilterGroups is defined as a list of lists of WebhookFilter objects (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-projecttriggers.html) but in stratosphere it's a list of WebhookFilter (https://github.com/freckle/stratosphere/blob/14efb6e934263ea873e10c152f354f637a4a6520/library-gen/Stratosphere/ResourceProperties/CodeBuildProjectProjectTriggers.hs#L17) so it produces an invalid Cloudformation template

The result in CloudFormation would look like

FilterGroups:
        - - Type: EVENT
            Pattern: PULL_REQUEST_CREATED,PULL_REQUEST_UPDATED
          - Type: BASE_REF
            Pattern: ^refs/heads/master$
            ExcludeMatchedPattern: false
        - - Type: EVENT
            Pattern: PUSH
          - Type: HEAD_REF

while in stratosphere:

FilterGroups:
    - Type: EVENT
       Pattern: PULL_REQUEST_CREATED,PULL_REQUEST_UPDATED

resulting error in cloudformation: Property validation failure: [Value of property {/Triggers/FilterGroups/0} does not match type {Array}

jdreaver commented 5 years ago

Hey @dmateusp, good catch! The current AWS spec document has tons of errors that I have to manually fixed. I must have messed up fixing this one.

jdreaver commented 5 years ago

The definition of filter groups in the spec file from AWS looks like this:

    "AWS::CodeBuild::Project.FilterGroup": {
      "Type": "List",
      "Required": false,
      "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-codebuild-project-filtergroup.html",
      "ItemType": "WebhookFilter",
      "UpdateType": "Mutable"
    }

Unfortunately, this does not follow their published spec (see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-resource-specification-format.html). I opened an Enterprise support ticket with AWS about a few of these ill-defined resources a month ago and I still haven't received a response. I'm waiting to see how they are going to handle situations like this in the future.

dmateusp commented 5 years ago

Ah I see :/ thank you for looking into it!

mbj commented 1 year ago

@dmateusp My work in #207 that also has re-done the generator from ground up + re-generated the services from latest CF resource specification now properly encodes a list of lists. This work is unreleased as of the moment, but I'm closing this issue on that reason for the moment.