Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(ecr): ECR is generating invalid cloudformation #13418

Closed
cplee opened this issue Mar 5, 2021 · 7 comments · Fixed by #13420
Closed

(ecr): ECR is generating invalid cloudformation #13418

cplee opened this issue Mar 5, 2021 · 7 comments · Fixed by #13420
Assignees
Labels
@aws-cdk/aws-cloudformation Related to AWS CloudFormation @aws-cdk/aws-ecr Related to Amazon Elastic Container Registry bug This issue is a bug. effort/small Small work item – less than a day of effort p1

Comments

@cplee
Copy link
Contributor

cplee commented Mar 5, 2021

When creating an ECR repository with image_scan_on_push enabled, the resulting CloudFormation template is invalid and reports an error.

ecr_repo = ecr.Repository(
                self,
                "ecr-repository",
                image_scan_on_push=True,
                repository_name=ecr_repo_name,
            )

Stack operations on resource archivemicrosoftecrrepository7FB5D8DF would fail starting from 03/01/2021 as the template has invalid properties. Please refer to the resource documentation to fix the template. Properties validation failed for resource archivemicrosoftecrrepository7FB5D8DF with message: #/ImageScanningConfiguration: extraneous key [scanOnPush] is not permitted

Reproduction Steps

What did you expect to happen?

CloudFormation template should look like:

"ImageScanningConfiguration" : {
      "ScanOnPush": "true"
    }

What actually happened?

"ImageScanningConfiguration" : {
      "scanOnPush": "true"
    }

Environment

  • CDK CLI Version : 1.91.0
  • Framework Version: 1.91.0
  • Node.js Version: v14.11.0
  • OS : macOS
  • Language (Version): Python 3.8.6

Other


This is 🐛 Bug Report

@cplee cplee added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Mar 5, 2021
@github-actions github-actions bot added @aws-cdk/aws-cloudformation Related to AWS CloudFormation @aws-cdk/aws-ecr Related to Amazon Elastic Container Registry labels Mar 5, 2021
cplee added a commit to cplee/aws-cdk that referenced this issue Mar 5, 2021
@NetaNir
Copy link
Contributor

NetaNir commented Mar 5, 2021

Were you able to deploy the template? The scheme is case insensitive** so it should work.
Generally, the Resource scheme is automatically generated from the CloudFormation spec, we only patch the generated L1s in the rare event the spec had a breaking change. See example in #12204.


**only true for some resources

@cplee
Copy link
Contributor Author

cplee commented Mar 5, 2021

This used to work but is now reporting the error above

@MrArnoldPalmer
Copy link
Contributor

@cplee does this work with previous versions of CDK? Or was it working previously with 1.91.0 and then just stopped?

@cplee
Copy link
Contributor Author

cplee commented Mar 5, 2021

Check out aws-cloudformation/cloudformation-coverage-roadmap#245 for similar issue

@MrArnoldPalmer
Copy link
Contributor

MrArnoldPalmer commented Mar 5, 2021

Thanks @cplee. Was trying to figure out if this was something that changed on the service side, which it appears to be if this previously worked.

Gonna keep investigating as #13420 fixes this for users of ecr.Repository but someone using ecr.CfnRepository may be passing scanOnPush themselves and their app will be broken still.

@MrArnoldPalmer MrArnoldPalmer added effort/small Small work item – less than a day of effort p1 and removed needs-triage This issue or PR still needs to be triaged. labels Mar 5, 2021
@mergify mergify bot closed this as completed in #13420 Mar 5, 2021
mergify bot pushed a commit that referenced this issue Mar 5, 2021
fix #13418: Update ECR construct to generate valid CloudFormation when enabling `imageScanOnPush`


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

github-actions bot commented Mar 5, 2021

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

cornerwings pushed a commit to cornerwings/aws-cdk that referenced this issue Mar 8, 2021
fix aws#13418: Update ECR construct to generate valid CloudFormation when enabling `imageScanOnPush`


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-cloudformation Related to AWS CloudFormation @aws-cdk/aws-ecr Related to Amazon Elastic Container Registry bug This issue is a bug. effort/small Small work item – less than a day of effort p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants