https://pulumi.com logo
#general
Title
# general
g

gifted-restaurant-30072

05/06/2020, 6:53 PM
Hi, I've got an odd question and maybe there's a much better way to do this. Essentially I'm trying to implement a different comparison for my ECS service's task definition in golang. Our Docker build process produces images with different IDs even when the base image and the service we're running in the image have not changed. This causes Pulumi to always create a new task definition during deployments. We want to avoid this so I was looking into computing the hash of the image inputs (base image and service executable) and comparing that to the hashes of the currently deployed image. If they are the same, I want the task definition to use the same Docker image ID instead of the new one. To accomplish this I need to store those hashes and, ideally, I'd like to store them in the state file. I've tried adding them as outputs on my component resource that encapsulates all the ECS resources but I can't find a way to read those values at runtime of the pulumi program. I tried using
pulumi.Context.ReadResource
but this requires my component resource to embed
CustomResourceState
instead of
ResourceState
and when calling
ReadResource
it produces an error stating there isn't a plugin for the namespace I'm using for my component resource. So, finally, to my question, is there a way to read the outputs of a component resource inside a pulumi program without just parsing the state file directly?