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): setting imageScanOnPush to false doesn't update Repository after first being set to true #18077

Closed
peterwoodworth opened this issue Dec 17, 2021 · 2 comments · Fixed by #18078
Labels
@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 p2

Comments

@peterwoodworth
Copy link
Contributor

What is the problem?

Setting imageScanOnPush to false sets the property on the underlying CfnRepository to undefined

const resource = new CfnRepository(this, 'Resource', {
repositoryName: this.physicalName,
// It says "Text", but they actually mean "Object".
repositoryPolicyText: Lazy.any({ produce: () => this.policyDocument }),
lifecyclePolicy: Lazy.any({ produce: () => this.renderLifecyclePolicy() }),
imageScanningConfiguration: !props.imageScanOnPush ? undefined : {
scanOnPush: true,
},

This is fine when creating the Repository because the default setting is to set this to false. However, it appears this is only the default setting for creating the repository - not the default setting for updating the repository.

Reproduction Steps

First create a new ECR Repository with imageScanOnPush set to true

 const repo = new Repository(this, 'repo', {
   imageScanOnPush: true
 })

Then update that setting to false and deploy

What did you expect to happen?

ScanOnPush to be set to false in AWS console

What actually happened?

ScanOnPush is still set to true

CDK CLI Version

2.2.0

Framework Version

No response

Node.js Version

16.0.0

OS

Mac

Language

Typescript

Language Version

No response

Other information

No response

@peterwoodworth peterwoodworth added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Dec 17, 2021
@github-actions github-actions bot added the @aws-cdk/aws-ecr Related to Amazon Elastic Container Registry label Dec 17, 2021
@peterwoodworth peterwoodworth added effort/small Small work item – less than a day of effort p2 and removed needs-triage This issue or PR still needs to be triaged. labels Dec 17, 2021
@peterwoodworth
Copy link
Contributor Author

If you want to set this property to false after first having it set to true, use an escape hatch to set scanOnPush to false on the underlying CfnRepository.

@mergify mergify bot closed this as completed in #18078 Mar 18, 2022
mergify bot pushed a commit that referenced this issue Mar 18, 2022
… existing repository (#18078)

fixes #18077 


----

*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

⚠️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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@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 p2
Projects
None yet
2 participants