Skip to content

Is it possible to edit the ImageUri value generated by DockerImageFunction? #29091

Answered by WayneLIT
WayneLIT asked this question in Q&A
Discussion options

You must be logged in to vote

I eventually came to a workaround.

I could find no way to change the account number for the ImageUri field. Looks like it takes it from the account details passed in the env dict when instantiating the stack.

The only way around this was to use the lower level CfnFunction resource instead of DockerImageFunction. I created the docker asset separately and constructed the desired imageUri field. In the future this could be included in an internal construct or synthesizer but for now it is a reasonable approach

code_asset = DockerImageAsset(self, "MyBuildImage", directory="pipeline/lambda")

image_uri = (
    f"ACCOUNT-B.dkr.ecr.{self.region}.",
    f"{self.url_suffix}/cdk-Qualifier-container…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by WayneLIT
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants