why is the following code, creating 6 resources in...
# general
why is the following code, creating 6 resources instead of 3? If I understood the api correctly, i can create a ECR repository and pass it into the buildAndPushImage
Copy code
export function createApiImage(name: string, port: number, contextDir: string): {repositoryUrl: pulumi.Output<string>, image: awsx.ecr.RepositoryImage} {
  const gitCommit = 'e0e5162';

  // set up ECR Lifecycle Policies (<https://docs.aws.amazon.com/AmazonECR/latest/userguide/LifecyclePolicies.html>) 
  // remove any images that are older than one week that are untagged
  const repository = new awsx.ecr.Repository(`pulumi-${pulumi.getStack()}-repository`, {
    lifeCyclePolicyArgs: {
      rules: [{
          selection: "untagged",
          maximumAgeLimit: 7,

  // And publish its URL, so we can push to it if we'd like.
  const repositoryUrl = repository.repository.repositoryUrl;

  const build: docker.DockerBuild = {
    context: contextDir, // context is a path to a directory to use for the Docker build context
    dockerfile: path.join(contextDir, './docker/api.v2.Dockerfile'), // dockerfile may be used to override the default Dockerfile name and/or location
    args: {
      EXPOSE_PORT: String(port),

  // Invoke 'docker' to actually build the DockerFile that is in the folder relative to
  // this program. Once built, push that image up to the ECR repo.
  //const image = repository.buildAndPushImage(build);
  const image = awsx.ecr.buildAndPushImage(
      repository: repository.repository,

  return {repositoryUrl, image};
Copy code
→ pulumi up
Previewing update (dev):

     Type                           Name                          Plan
 +   pulumi:pulumi:Stack            dev                    create
 +   ├─ awsx:ecr:Repository         dev-api-image:e0e5162  create
 +   │  └─ aws:ecr:LifecyclePolicy  dev-api-image:e0e5162  create
 +   └─ awsx:ecr:Repository         pulumi-dev-repository         create
 +      ├─ aws:ecr:Repository       pulumi-dev-repository         create
 +      └─ aws:ecr:LifecyclePolicy  pulumi-dev-repository         create

    + 6 to create

Do you want to perform this update?
> no
There are only 3 actual resources here. 2 others are "component resources" virtual containers that don't map to anything in AWS on their own. And the last one is a stack, the top-level container.
Maybe it would be useful to differentiate them visually
I think differentiating them would be a nice touch. Would certainly provide better visual feedback when watching the output as a stack completes as well.
thank you for the explanation. Yes, it would be nice to see, what resources are actually created on aws.
Do you mind creating an issue for this in https://github.com/pulumi/pulumi/ ?
sorry, just saw this message now. certianly i can do that