Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Branch planner not showing workspace #968

Open
eloo-abi opened this issue Sep 13, 2023 · 6 comments
Open

Branch planner not showing workspace #968

eloo-abi opened this issue Sep 13, 2023 · 6 comments
Labels

Comments

@eloo-abi
Copy link

Hi,

i just testing the branch planner feature and discovered that the reported plan nor the PR comment itself is having reference to the workspace used.

This makes it pretty hard to determine which change is relevant for what environment.

image

i would suggest to have at least the following information added to the comments:

  • name of the terraform k8s resource
  • workspace from the terraform k8s resource
  • path from the terraform k8s resource

Thanks

@chanwit
Copy link
Collaborator

chanwit commented Sep 13, 2023

Thank you @eloo-abi for your suggestion.

Would you mind drafting the output you'd like to see as a simple code block here?

@eloo-abi
Copy link
Author

tf-controller plan output:

context:

  • namespace: flux-system
  • name: jowe-tf-controller-test
  • approvePlan: auto
  • path: ./
  • workspace: default
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # local_file.changeme_local_file_hello will be created
  + resource "local_file" "changeme_local_file_hello" {
      + content              = "Hello terraform local!"
      + content_base64sha256 = (known after apply)
      + content_base64sha512 = (known after apply)
      + content_md5          = (known after apply)
      + content_sha1         = (known after apply)
      + content_sha256       = (known after apply)
      + content_sha512       = (known after apply)
      + directory_permission = "0777"
      + file_permission      = "0777"
      + filename             = "./changeme_local_file_hello_default.txt456"
      + id                   = (known after apply)
    }

Plan: 1 to add, 0 to change, 0 to destroy.

To apply this plan, please merge this pull request.

@eloo-abi
Copy link
Author

maybe something like this?

@chanwit
Copy link
Collaborator

chanwit commented Sep 13, 2023

Got it. That was helpful.

So they are basically some information from the original TF resource.

@eloo-abi
Copy link
Author

yes exactly.. so its just clear what is going to be changed..

the same of course applies to the notification..
at least the resource name is added in the notification already terraform/jowe-tf-controller-test-workspace-test.flux-system

@dwalker-sabiogroup
Copy link

We have a similar requirement to be able to show additional information in the PR comment as we have multiple terraform resources that are posting PR comments to a single PR and it is difficult to tell which terraform resource the comments relate to.

It would also be useful to be able to make the customization of the template configurable either then a command line argument or environment variable.

It would also be really useful to be able to access other notable plan information in the template rather than just the whole content of the plan output. In particular this sort of struct would be very useful e.g.

type Plan strict {
	Output          string
	TotalAdd        int
	TotalChange     int
	TotalDestory    int
	AddResources    []string // all resource names that are being added
	ChangeResources []string // all resource names that are being changed
	DestoryResource []string // all resource names that are being destroyed
}

This would be particularly useful for large plan outputs that can be hard to read and just present a summary.

@lasomethingsomething lasomethingsomething added the kind/enhancement New feature or request label Oct 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants