agreeable-window-77899
07/19/2022, 11:06 AMawsx.ecs.FargateService
which automatically creates ecr
repository for the container images. But while attempting to pulumi destroy
the stack I get this error
* ECR Repository (***-api-server-38-07d115e) not empty, consider using force_delete: RepositoryNotEmptyException: The repository with name '***-api-server-38-07d115e' in registry with id '***' cannot be deleted because it still contains images
Is there a way to force delete the ecr repo which is auto-created by awsx
?
Below is the way I'm creating the Fargate Service
const fargateService = new awsx.ecs.FargateService(`tooling-app-${stackName}`, {
name: `tooling-app-${stackName}`,
cluster: fargateCluster,
desiredCount: 1,
forceNewDeployment: true,
taskDefinitionArgs: {
containers: {
apolloServer: {
image: awsx.ecs.Image.fromDockerBuild(
`tooling-api-server-${stackName}`,
{
dockerfile: "../../api-server/Dockerfile",
context: "../../api-server/",
}
),
portMappings: [albTargetGroupApiServer],
},
}
}
"@pulumi/aws": "^5.0.0",
"@pulumi/awsx": "^0.40.0",
"@pulumi/pulumi": "^3.0.0"
billowy-army-68599
agreeable-window-77899
07/19/2022, 3:06 PMawx.ecs.FargateService
create the ecr
repository. Instead I created the instance explicitly with the forceDelete: true,
flag and that seems to do the trick. Now it is deleting the ecr
repo when I do pulumi destroy
.
Here is the code that worked:
const toolingApiServerEcrRepo = new aws.ecr.Repository(
`tooling-app-api-server-${stackName}`,
{
name: `tooling-app-api-server-${stackName}`,
forceDelete: true,
tags: { app: "tooling-app", stack: stackName },
}
);