Azure / container-apps-deploy-action

GitHub Action for building and deploying Azure Container Apps
MIT License
51 stars 30 forks source link

Disable creation of container app #45

Open razum90 opened 1 year ago

razum90 commented 1 year ago

Hi!

Is there any way to configure that the container app should not be created in case it does not exist? In our case we are setting up the container apps using terraform, and we just use this action to deploy it. So we would like to make sure that this action never creates the container app in case it does not exist since we want to keep controlling it through terraform.

BR, Rasmus

cormacpayne commented 1 year ago

@razum90 Hey Rasmus, apologies for the delayed response -- just to confirm that I understand the ask: you have a GitHub Actions workflow that firsts creates the Container App using Terraform, and then you have a follow-up step that uses this GitHub Action to just deploy the Container App based on the result of the Terraform operation. Is that correct?

If so, I think it would be best to keep that logic independent from this GitHub Action itself, since it's focused on building and/or deploying a Container App independent of if it exists or not. Since that wouldn't resolve your issue, I would recommend using a call to az containerapp show, similar to what we're doing in our action, to determine if the Container App exists or not. This would just be a single step you add to your workflow, the result would be written to an environment variable and a conditional could be added to your step calling this action that depends on the value of the environment variable.

Please feel free to let me know if this is a sufficient solution for your scenario, otherwise I'm happy to continue a discussion in this issue and see what other routes we can take. Thanks in advance!

razum90 commented 1 year ago

Hey @cormacpayne, no worries. Yes, correct. Those two actions are independent on each other though. But yes we control what container apps should exist through terraform and the deployment through this action. The reason we are doing that is because we need a more advanced setup of the container apps, with for example DNS records.

Do you mean to use the az cli directly instead? We started off doing that but the idea was to use this action instead to be able to take advantage of future features you would potentially add to it, like the one described in the other issue (#45) i reported.

BR, Rasmus

cormacpayne commented 1 year ago

@razum90 -- what I proposed would directly use a single command from the Azure CLI that would be called between your Terraform step and this GitHub Actions step. The Azure CLI command would just check whether or not the Container App was created during the Terraform step, and if so, you would then proceed to use this GitHub Action for deployment. You would still be able to leverage the features of the GitHub Action that we'd be introducing, you would just have one additional step before it to check for the Container App existence and nothing else.

This way, the scope of our GitHub Action remains focused on building and/or deploying Container Apps independent of if they exist or not, and your workflow will be able to quickly verify the result of the Terraform step with one single Azure CLI command call before then using the GitHub Action.

Hopefully that clears things up a bit -- please let me know otherwise!

razum90 commented 1 year ago

Ah yep I got it now @cormacpayne, thanks for the explanation. While it would be handy for us if it could be built into this action I do understand if you don't want too much conditional complexity in it.