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

[Python] ECR's "tag immutability" property not available? #4640

Assignees
Labels
@aws-cdk/aws-ecr Related to Amazon Elastic Container Registry effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. in-progress This issue is being actively worked on. language/python Related to Python bindings p1

Comments

@brainstorm
Copy link

The Question

The constructor for aws_ecr on CDK python 1.14 seems to lack the ECR tag immutability flag:

"""Define an ECR repository."""
    def __init__(self, scope: aws_cdk.core.Construct, id: str, *, lifecycle_registry_id: typing.Optional[str]=None, lifecycle_rules: typing.Optional[typing.List["LifecycleRule"]]=None, removal_policy: typing.Optional[aws_cdk.core.RemovalPolicy]=None, repository_name: typing.Optional[str]=None) -> None:
        """
        :param scope: -
        :param id: -
        :param props: -
        :param lifecycle_registry_id: The AWS account ID associated with the registry that contains the repository. Default: The default registry is assumed.
        :param lifecycle_rules: Life cycle rules to apply to this registry. Default: No life cycle rules
        :param removal_policy: Determine what happens to the repository when the resource/stack is deleted. Default: RemovalPolicy.Retain
        :param repository_name: Name for this repository. Default: Automatically generated name.
        """

Skärmavbild 2019-10-23 kl  16 40 34

Environment

  • CDK CLI Version: 1.14.0 (build 261a1bf)
  • Module Version: aws-cdk.aws-ecr==1.14.0
  • OS: OSX Catalina 10.15
  • Language: Python
@brainstorm brainstorm added the needs-triage This issue or PR still needs to be triaged. label Oct 23, 2019
@nmussy
Copy link
Contributor

nmussy commented Oct 23, 2019

Hey @brainstorm,

Unfortunately, the field is currently not implemented in CloudFormation.

An issue was opened on the roadmap, aws-cloudformation-coverage-roadmap#222. Feel free to add a +1 reaction to the issue to encourage the CloudFormation team to add it.

@SomayaB SomayaB added language/python Related to Python bindings @aws-cdk/aws-ecr Related to Amazon Elastic Container Registry labels Oct 23, 2019
@SomayaB SomayaB self-assigned this Oct 23, 2019
@SomayaB SomayaB added needs-cfn This issue is waiting on changes to CloudFormation before it can be addressed. and removed needs-triage This issue or PR still needs to be triaged. labels Oct 23, 2019
@SomayaB SomayaB added the feature-request A feature should be added or improved. label Nov 15, 2019
@SomayaB SomayaB assigned MrArnoldPalmer and unassigned SomayaB May 12, 2020
@acceleratesage
Copy link

acceleratesage commented Aug 21, 2020

I just stumbled upon this, as I need to set this property and it seems to be available in CloudFormation: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecr-repository.html#cfn-ecr-repository-imagetagmutability

So the needs-cfn tag could be removed.

@njlynch njlynch removed the needs-cfn This issue is waiting on changes to CloudFormation before it can be addressed. label Aug 24, 2020
@1davidmichael
Copy link
Contributor

Not ideal but since this is now implemented in CloudFormation you can use the raw CFN resource to create it:

ecr_props = {
    "ImageScanningConfiguration": {
        "scanOnPush": "true"
    },
    "ImageTagMutability": "IMMUTABLE"
}

core.CfnResource(
    self,
    "ECR",
    type="AWS::ECR::Repository",
    properties=dict(ecr_props)
)

I am sure it is possible to do with an override on the higher level construct but I am not quite sure what that looks like.

@ap00rv
Copy link
Contributor

ap00rv commented Sep 26, 2020

I am done implementing this feature and would like to send pull request today. cc @SomayaB

ap00rv added a commit to ap00rv/aws-cdk that referenced this issue Sep 26, 2020
This property allows setting tag mutability on ECR repositoes. Tag mutability is useful to ensure image integrity and can prevent supply chain attacks.

Closes aws#4640
@SomayaB SomayaB added the in-progress This issue is being actively worked on. label Sep 29, 2020
@melnikalex
Copy link

I am sure it is possible to do with an override on the higher level construct but I am not quite sure what that looks like.

Anyone have any suggestions on what the override will look like?

@MrArnoldPalmer MrArnoldPalmer added effort/small Small work item – less than a day of effort p1 labels Dec 7, 2020
@vsetka
Copy link

vsetka commented Jan 21, 2021

So, this was shipped in November in CF. Any idea where this will be implemented in the CDK?

@mergify mergify bot closed this as completed in #10557 Mar 9, 2021
mergify bot pushed a commit that referenced this issue Mar 9, 2021
This property allows setting tag mutability on ECR repositoes. Tag mutability is useful to ensure image integrity and can prevent supply chain attacks.

Closes #4640


----

*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 9, 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.

This was referenced Mar 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment