This message was deleted.
# help
b
This message was deleted.
đź‘€ 1
m
Hi Joe, I’ve got a few questions to make sure I understand correctly what you want to do 1. When a user/bot opens a MR request to master you create two infracost comments on the MR. One for the test env and one for the prod env? 2. Following on from the above. How do these two environments differ and how is this configured in terraform? i.e. do you pass a different terraform tfvar file/workspace? 3. Infracost Gitlab app only has the ability to post one comment right now. Following the logic above, we’d normally suggest users aggregate the Infracost output into one single comment. With this approach you’d have a table with all your projects shown. e.g. “test-some-app”, “prod-some-app”. Would this approach work for you, or do you require the separate comments to post to different sections in your wiki? 4. It is not possible to define stages in Infracost Gitlab app, but with the CI/CD pipeline you’ve described I don’t believe it’s necessary to. We should hopefully be able to get you a working config file/template that will provide the correct configurations for your setup.
r
In answer to question 1) yes (in some case there may only be one env, due to licencing or as no prodction instance has been completed) 2) The difference between Environments is set in the gitlab-ci.yaml file as terraform Environment variables. Or in some case the terraform main.tf if very static, the terraform code then dose a selection using a Gitlab variable set in the job. Due to some use case we have two main terraform Env we look for that are configure at a CI job stage
Copy code
TF_VAR_Gitlab_Environment: prod or TF_VAR_Gitlab_Environment: test
      TF_VAR_Greenpeace_Environment: test or TF_VAR_Greenpeace_Environment: prod
3) One comment as documentation is fine.
m
ok so in this case it should be quite easy to define a config file with the required variables. You would just specify these environment variables in the
env
key of the project, e.g;
Copy code
version: 0.1
projects:
  - path: some/path/to/terraformcode
    name: dev
    terraform_vars:
      Gitlab_Environment: prod
      Greenpeace_Environment: test
I’m not sure if the
Gitlab_Environment
is actually used in the terraform code, if not just ommit it. You would then specify all your terraform projects by defining them in the config file. However, I’d recommend using our config template syntax as this will avoid duplication. For example you could do things like:
Copy code
version: 0.1

projects:
{{- $envs := list "prod" "test"}}
{{- range $envs }}
      - path: someapp
        name: {{ . }}-someapp
        terraform_vars:
          Greenpeace_Environment: {{ . }}
{{- end }}
It’s a little bit tricky to help further without knowing your project structure. And this is probably easier to go over on a call. We can get all the config template and stuff ironed out in that. Would a call tomorrow work?
r
yes i free most of the morning
👌 1