This message was deleted.
# localstack
s
This message was deleted.
b
this is indeed part of the
Image
resource: https://github.com/pulumi/pulumi-awsx/blob/ec3ee6d18087f1ac94bde9c609aadbf3ae9e4792/awsx/ecr/image.ts#L70 I guess it’s possibly localstack doesn’t support
getCredentials
?
r
I'll look into localstack and report back...
Created an issue in localstack repo: https://github.com/localstack/localstack/issues/7186
@billowy-army-68599 I wonder if this is awsx specific? I mean, they must support standard ecr stuff. I'll look into that tmo.
b
i don’t think it’s awsx specific, the underlying call is just a standard pulumi
get
. You can double check by running it outside the component, do you get the same behaviour?
r
ecr.getCredentials
shows up 4 times in all of github: https://github.com/search?q=ecr.getCredentialsOutput&type=code When you suggest
running it outside the component
, I'm not sure what that means.
b
aws.ecr.GetCredentials
is a pulumi specific call to retrieve credentials so it won’t show up elsewhere. When I say outside of the component, just make the call directly from your
__main__.py
Copy code
aws.ecr.get_credentials
instead of
Copy code
image = awsx.ecr.Image(
    resource_utils.get_name(awsx.ecr.Image),
    repository_url=repo.url,
    path=os.path.join(os.path.dirname(__file__), "..", "..", "docker", "_build"),
)
r
@billowy-army-68599 So running this
pulumilocal up
on this gives the same error:
Copy code
invocation of aws:ecr/getCredentials:getCredentials returned an error: error reading from server: EOF
Code
Copy code
import pulumi_awsx as awsx
import pulumi_aws as aws
from utils import resource_utils

# create an ecr repository in aws
repo = awsx.ecr.Repository(
    resource_utils.get_name(awsx.ecr.Repository),
    tags=resource_utils.tags(),
)

gcr = aws.ecr.get_credentials(registry_id=repo.repository.id)
print(f"gcr=${gcr}")
Error
Copy code
Traceback (most recent call last):
      File "/home/todd/tmp_5cuvoaql/backend-project-microservice/deploy/pulumi/./__main__.py", line 19, in <module>
        gcr = aws.ecr.get_credentials(registry_id=repo.repository.id)
      File "/home/todd/tmp_5cuvoaql/backend-project-microservice/deploy/pulumi/venv/lib/python3.10/site-packages/pulumi_aws/ecr/get_credentials.py", line 91, in get_credentials
        __ret__ = pulumi.runtime.invoke('aws:ecr/getCredentials:getCredentials', __args__, opts=opts, typ=GetCredentialsResult).value
      File "/home/todd/tmp_5cuvoaql/backend-project-microservice/deploy/pulumi/venv/lib/python3.10/site-packages/pulumi/runtime/invoke.py", line 144, in invoke
        raise invoke_error
    Exception: invoke of aws:ecr/getCredentials:getCredentials failed: invocation of aws:ecr/getCredentials:getCredentials returned an error: error reading from server: EOF

    panic: runtime error: index out of range [0] with length 0
b
yeah, looks like localstack doesn’t support returning credentials from its ECR resource 😞
r
@billowy-army-68599 yeah, my quick perusal of the localstack code base make me wonder how this could work. The only related code I can find for
ecr
is here: https://github.com/localstack/localstack/blob/0221d2908307c2b00e91336aa07e608669341788/localstack/services/cloudformation/models/ecr.py#L14
Copy code
# TODO: might make sense to limit this only for resources with logical id "ContainerAssetsRepository"
class ECRRepository(GenericBaseModel):
    """
    This is a mock repository to support modern CDK bootstrapping templates.
    It is not intended to be used with other ECR resources.
    """
From this commit: https://github.com/localstack/localstack/commit/0221d2908307c2b00e91336aa07e608669341788 I think, for our use case,
localstack
is not going to work. Bummer, b/c that would have been really cool.