Is it possible to use Pulumi to auto deploy from a...
# azure
g
Is it possible to use Pulumi to auto deploy from an Azure registry to an existing Azure container app and create a new revision?
m
Yeah, the way I've done this in the past is to have Pulumi set the image version. Then Azure Container Apps pulls the image from the registry. Here's some C# code I've used in the past:
Copy code
_ = new ContainerApp("my-app", new ContainerAppArgs{
    Template = new TemplateArgs
    {
        Containers = new[]
        {
            new ContainerArgs
            {
                Image = $"my-image-url",
                Name = "image-name"
            }
        },
    }
});
Note that you separately need to make sure the ACA instance has the permissions to pull from the container registry.
g
How did you get Azure Container apps to pull the image from the registry? I've got mine manually running, I just want to tell it to update it to the latest version?
m
A new revision will be made when you change the image version with Pulumi. So in my example code above, replace
my-image-version
with the specific version you want to use. Assuming you're using the Azure Container Registry, it'll be something like
<http://myregistry.azurecr.io/my-repo/my-image:111|myregistry.azurecr.io/my-repo/my-image:111>
and then change that to the next version like
<http://myregistry.azurecr.io/my-repo/my-image:222|myregistry.azurecr.io/my-repo/my-image:222>
. You'll have to do some extra work to pass that version to Pulumi. In the past when I've done this we had our CI/CD pipeline push the image to the container registry, then the pipeline did a text replace inside the Pulumi Stack config to set the version we just pushed, then the Pulumi app had to pull that from config to generate the URL to the container registry. It's a hassle, but Pulumi doesn't have a way to pass in parameters when it runs.