I'm following along with <these instructions> and ...
# python
s
I'm following along with these instructions and have a few questions...
I have the following method defined:
Copy code
# Get registry info (creds and endpoint).
    def getRegistryInfo(rid):
        creds = ecr.get_credentials(registry_id=rid)
        decoded = base64.b64decode(creds.authorization_token).decode()
        parts = decoded.split(':')
        if len(parts) != 2:
            raise Exception("Invalid credentials")
        return ImageRegistry(creds.proxy_endpoint, parts[0], parts[1])
and I'm defining an image like so:
Copy code
my_image = Image(
            self.name,
            image_name=pulumi.Output.concat(repo.repository_url, "/", custom_image, ":v1.0.0"),
            build=f'./docker/{custom_image}', #=DockerBuild(context=f'./docker/{custom_image}'),
            registry=ECRRepo.getRegistryInfo(repo.registry_id)
        )
where repo is an
ecr.Repository
object.
when I run my program I get the following error:
Copy code
Exception: invoke of aws:ecr/getCredentials:getCredentials failed: Missing required argument: The argument "registry_id" is required, but no definition was found. ()
Not sure what I'm missing, but I'd expect copy/pasting from this example would just work™
r
👋🏽 hey! trying to figure out where this code is in the post you linked
What is
ECRRepo
in your code?
In any case, I think in your image definition you might need to do something like:
Copy code
registry=repo.registry_id.apply(getRegistryInfo)
s
Thank you!
ECRRepo was the class containing the
getRegistryInfo
class method. I was confused, clearly, on how this all works
r
outputs and apply are definitely some of the trickiest parts of the pulumi learning curve. This doc kinda goes into it how it all works.
🙏 1