Skip to content

ecr: allow fromLookup method to return dummy repository without error if target repository was not found #34031

@go-to-k

Description

@go-to-k

Describe the feature

The fromLookup method causes an error if the target repository was not found. However it would be also good not to cause an error and to return dummy value in that case.

Now, with the PR merged in aws-cdk-cli ([email protected]), we can ignore errors and return dummy value with mustExist option in CC API Provider.

Use Case

If the target repository exists in the AWS account, it will be used, and if not, a new repository can be created in the stack.

Proposed Solution

  • Added the mustExist option in RepositoryLookupOptions.
    • Pass it to mustExist for ContextProvider.getValue

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.187.0

Environment details (OS name and version, etc.)

Mac

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-ecrRelated to Amazon Elastic Container Registryeffort/mediumMedium work item – several days of effortfeature-requestA feature should be added or improved.p2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions