terraform-aws-runtask-tf-plan-analyzer icon indicating copy to clipboard operation
terraform-aws-runtask-tf-plan-analyzer copied to clipboard

RFE: Post results as comment back to GitHub Pullrequest

Open jgrumboe opened this issue 1 year ago • 6 comments

Hi,

The run task looks promising in understanding specific changes better. I had a quick look at https://developer.hashicorp.com/terraform/cloud-docs/integrations/run-tasks#integration-details and saw that the payload for the run task would also include VCS information like commit and PR URLs. If it's a speculative plan, it would be great to also send the results back as a comment to the originating PR. What do you think?

Best regards, Johannes

jgrumboe avatar Oct 04 '24 10:10 jgrumboe

that is a good suggestion, thank you @jgrumboe

we have a few potential way to do it:

  1. Since we know the workspace id, we could push comment on the Workspace run, or
  2. As you suggested, bubble up the finding as pull request on the originating PR

wellsiau-aws avatar Oct 04 '24 18:10 wellsiau-aws

Thinking of our dev teams, the PR is the "source of truth" 🙂

The workspace comments are not used at all here.

jgrumboe avatar Oct 04 '24 18:10 jgrumboe

if you are using the tfc-workflow-tooling , we might able to bubble up the RunTasks plan output as part of it (which today is not yet available). Ref: https://github.com/hashicorp/tfc-workflows-tooling/blob/main/docs/USAGE.md#available-commands

cc @gautambaghel

wellsiau-aws avatar Oct 04 '24 21:10 wellsiau-aws

We're not using the tf-workflow-tooling; our workspaces are "normal" VCS connected.

jgrumboe avatar Oct 07 '24 06:10 jgrumboe

Hey @jgrumboe I opened a new PR #13 to address this, would this satisfy your requirement? The additional piece would be that you need to supply the GitHub token.

It needs to be a Fine-grained personal access tokens

with access to

  • Read access to metadata
  • Read and Write access to pull requests

gautambaghel avatar Oct 09 '24 05:10 gautambaghel

@gautambaghel Thanks, and sorry for coming back here so late. I will give it a try in the next weeks.

jgrumboe avatar Dec 11 '24 11:12 jgrumboe