runatlantis / atlantis

Terraform Pull Request Automation
https://www.runatlantis.io
Other
7.68k stars 1.05k forks source link

Projects defined, with custom workflows, show up as the same project in the Atlantis UI, jobs section #4280

Open dimisjim opened 6 months ago

dimisjim commented 6 months ago

Community Note

Overview of the Issue

image

I have set multiple projects, with custom workflows in my repo, but in the UI it shows up as default workspace and project name the same for all

Reproduction Steps

atlantis repo-level config:

version: 3
projects:
- name: dev
  workflow: dev
  dir: .
  autoplan:
    when_modified: ["*.tf", "env-vars/dev.tfvars"]
- name: qa
  workflow: qa
  dir: .
  autoplan:
    when_modified: ["*.tf", "env-vars/qa.tfvars"]
- name: prod
  workflow: prod
  dir: .
  autoplan:
    when_modified: ["*.tf", "env-vars/prod.tfvars"]

workflows:
  dev:
    plan:
      steps:
      - init:
          extra_args: ["-backend-config=backend-configs/dev.hcl", "-reconfigure", "-upgrade"]
      - plan:
          extra_args: ["-var-file=env-vars/dev.tfvars"]
    apply:
      steps:
      - run: |
          if [ "$BASE_BRANCH_NAME" = "dev" ]; then
            echo "we are on dev branch, thus proceeding with the apply!"
            terraform${ATLANTIS_TERRAFORM_VERSION} apply "$PLANFILE"
          else
            echo "we are not on dev branch, thus canceling the apply"
          fi
  qa:
    plan:
      steps:
      - init:
          extra_args: ["-backend-config=backend-configs/qa.hcl", "-reconfigure", "-upgrade"]
      - plan:
          extra_args: ["-var-file=env-vars/qa.tfvars"]
    apply:
      steps:
      - run: |
          if [ "$BASE_BRANCH_NAME" = "qa" ]; then
            echo "we are on qa branch, thus proceeding with the apply!"
            terraform${ATLANTIS_TERRAFORM_VERSION} apply "$PLANFILE"
          else
            echo "we are not on qa branch, thus canceling the apply"
          fi
  prod:
    plan:
      steps:
      - init:
          extra_args: ["-backend-config=backend-configs/prod.hcl", "-reconfigure", "-upgrade"]
      - plan:
          extra_args: ["-var-file=env-vars/prod.tfvars"]
    apply:
      steps:
      - run: |
          if [ "$BASE_BRANCH_NAME" = "prod" ]; then
            echo "we are on prod branch, thus proceeding with the apply!"
            terraform${ATLANTIS_TERRAFORM_VERSION} apply "$PLANFILE"
          else
            echo "we are not on prod branch, thus canceling the apply"
          fi

Environment details