hey guys, im trying to use the new Docker Build p...
# general
d
hey guys, im trying to use the new Docker Build provider with AWS Lambda. All the existing docs use the image.uri or image.name from the result of the newImage() function as the imageURI for a new lambda. The new Docker Build provider doesnt return any ECR URI to use for the lambda as far as i can tell. Any ideas?
Copy code
lambdaImage, err := dockerbuild.NewImage(ctx, "my-image", &dockerbuild.ImageArgs{
		// Tag our image with our ECR repository's address.
		Tags: pulumi.StringArray{
			repo.RepositoryUrl.ApplyT(func(repositoryUrl string) (string, error) {
				return fmt.Sprintf("%v:latest", repositoryUrl), nil
			}).(pulumi.StringOutput),
		},
		Context: &dockerbuild.BuildContextArgs{
			Location: pulumi.String(dpResizerLambdaDir),
		},
		// Use the pushed image as a cache source.
		CacheFrom: dockerbuild.CacheFromArray{
			&dockerbuild.CacheFromArgs{
				Registry: &dockerbuild.CacheFromRegistryArgs{
					Ref: repo.RepositoryUrl.ApplyT(func(repositoryUrl string) (string, error) {
						return fmt.Sprintf("%v:latest", repositoryUrl), nil
					}).(pulumi.StringOutput),
				},
			},
		},
		// Include an inline cache with our pushed image.
		CacheTo: dockerbuild.CacheToArray{
			&dockerbuild.CacheToArgs{
				Inline: nil,
			},
		},
		// Build a multi-platform image manifest for ARM and AMD.
		Platforms: dockerbuild.PlatformArray{
			dockerbuild.Platform_Linux_arm64,
		},
		// Push the final result to ECR.
		Push: pulumi.Bool(true),
		// Provide our ECR credentials.
		Registries: dockerbuild.RegistryArray{
			&dockerbuild.RegistryArgs{
				Address: repo.RepositoryUrl,
				Password: authToken.ApplyT(func(authToken ecr.GetAuthorizationTokenResult) (*string, error) {
					return &authToken.Password, nil
				}).(pulumi.StringPtrOutput),
				Username: authToken.ApplyT(func(authToken ecr.GetAuthorizationTokenResult) (*string, error) {
					return &authToken.UserName, nil
				}).(pulumi.StringPtrOutput),
			},
		},
	})
	if err != nil {
		return nil, err
	}
	
	

	// Set arguments for constructing the function resource.
	args := &lambda.FunctionArgs{
		PackageType: pulumi.String("Image"),
		ImageUri:    lambdaImage.?????
		Role:        role.Arn,
		Architectures: pulumi.StringArray{
			pulumi.String("arm64"),
		},
		Environment: &lambda.FunctionEnvironmentArgs{
			Variables: pulumi.StringMap{
				"DISTRIBUTION_BUCKET": distBucket.Bucket,
			},
		},
		Timeout: <http://pulumi.Int|pulumi.Int>(30),
	}
Im just setting the lambda to always use :latest and forcing a dependancy between the lambda and the image upload
Copy code
imageURI := lambdaImage.Ref.ApplyT(func(ref string) (pulumi.StringOutput, error) {
		return pulumi.Sprintf("%v:latest", repo.RepositoryUrl), nil
	}).(pulumi.StringOutput) //creates dependancy on just setting lambda to @latest to occur after image is pushed