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

[PROPOSAL] Expose project name as environmental variable in run steps #539

Closed
paranoidd opened this issue Mar 14, 2019 · 3 comments · Fixed by #578
Closed

[PROPOSAL] Expose project name as environmental variable in run steps #539

paranoidd opened this issue Mar 14, 2019 · 3 comments · Fixed by #578
Labels
feature New functionality/enhancement quick-win Is obviously something Atlantis should do and will take <4 hrs work

Comments

@paranoidd
Copy link

Hello!
First of all, thank you very much for the work with Atlantis. It made my life easy and happy.

I am coming with suggestion to expose the name of project (from atlantis.yaml) as environmental variable for the RUN stages.

Why? I am sending slack notifications with run stage, and when Atlantis creates multiple plans for all AWS accounts we have, it's hard to distinguish which one is which. Having project name would solve this issue for me.

Thank you!

@lkysow lkysow added feature New functionality/enhancement quick-win Is obviously something Atlantis should do and will take <4 hrs work labels Apr 4, 2019
@lkysow
Copy link
Member

lkysow commented Apr 4, 2019

@nikovirtala
Copy link
Contributor

nikovirtala commented Apr 6, 2019

I would like to see also name of the workflow as an environment variable, which would allow me to set, e.g. backend config based on workflow name:

workflows:
  sandbox:
    plan:
      steps:
      - run: rm -rf .terraform
      - init:
          extra_args: ["-backend-config=$WORKFLOW.backend.tfvars"]
      - plan:
          extra_args: ["-var-file=$WORKSPACE.tfvars", "-lock=true"]
    apply:
      steps:
      - apply:
          extra_args: ["-lock=true"]

Instead of:

workflows:
  sandbox:
    plan:
      steps:
      - run: rm -rf .terraform
      - init:
          extra_args: ["-backend-config=sandbox.backend.tfvars"]
      - plan:
          extra_args: ["-var-file=$WORKSPACE.tfvars", "-lock=true"]
    apply:
      steps:
      - apply:
          extra_args: ["-lock=true"]

This seems a little bit more tricky (at least for me :)) than adding the project name which is more or less already is in place, it is just not exposed as an environment variable. Nevertheless, if you give me some pointers I could try to get it done anyway.

@lkysow
Copy link
Member

lkysow commented Apr 7, 2019

Yeah the way it's architected now, that part of the code has no knowledge of workflow names. That's intentional because I was trying to keep the two parts independent.

Given that whenever you define the workflow its name is directly above it in your config (so it's not that big a deal to duplicate the words), I'd like to keep it the way it is for now for the architectural reasons outlined above. If there are more compelling use-cases then I'm happy to revisit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New functionality/enhancement quick-win Is obviously something Atlantis should do and will take <4 hrs work
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants