In my current assignment, I am integrating terraform to our Azure DevOps CI/CD pipeline. My requirements are as follows:
- The creation of PR should trigger a build pipeline.
- A task in the build pipeline should publish a comment to the raised PR. The content of comment will be the terraform plan output i.e the new infrastructure that is going to be deployed.
- Once the PR is approved and code merged to master, a CD pipeline would be triggered and that will deploy the infrastructure to Azure.
Up until now, I am all sorted on 1 and 3 requirements but I have no clue how can I publish a comment on PR with the contents from terraform plan command. Is there any built-in task for this? If not how can I achieve this? Is this possible at all? If so, can someone point out a resource that can help or just show the same .yml file?
I have searched a lot but did not find anything. My guess is you cannot add a comment from the build pipeline. Need your suggestions.