How can I call aws.codeartifact.getRepositoryEndpoint for a repository that is being provisioned in the same file

16 Views Asked by At

Using pulumi typescript, I want to create a codeartifact Domain and Repository. I need to get the endpoint for the Repository, so I can plug them into other resources that I'm creating. However when I run this code below, I always get an error because the Domain and Repository don't exist.

Is there any way I can fix this?

// Define the CodeArtifact domain.
const codeArtifactDomain = new aws.codeartifact.Domain("myDomain", {
    domain: "my-domain",
});

// Define the CodeArtifact repository after the domain is created.
const codeArtifactRepo = new aws.codeartifact.Repository("myRepository", {
    domain: codeArtifactDomain.domain,
    repository: 'repo'
    // Additional repository configuration...
});

// Retrieve the repository endpoint after both the domain and repository have been provisioned.
export const endpoint = pulumi.all([codeArtifactDomain.domain, codeArtifactRepo.domain]).apply(([domain, repo]) => {
    return aws.codeartifact.getRepositoryEndpoint({
        domain: domain,
        repository: repo,
        format: "npm", // or the package format you're using like 'maven', 'nuget', 'pypi', etc.
    });
});
0

There are 0 best solutions below