in atlantis.yaml can I set workspace to $HEAD_BRAN...
# atlantis-community
c
in atlantis.yaml can I set workspace to $HEAD_BRANCH_NAME? I use renovate to update dependencies so would like to test what changes those would make but 99% of the time renovate finds many dependency updates and creates a branch and PR for each of them. This causes issue since all run on the
dir: . workspace: default
so we end up with locking so it would be useful for these projects to change the workspace to be based on the MR id or the branch it creates (HEAD_BRANCH_NAME)
v
I think workspace won't work for you as this is terraform workspace. I had a similar issue when trying to run terraform with multiple environments on the same folder, I fixed with custom workflows defining a workflow per environment, this way it would not lock as it was running per project name:
Copy code
workflows:
    dev:
      plan:
        steps:
          - run: rm -rf .terraform
          - init:
              extra_args: [-backend-config=dev.s3.tfbackend -backend-config=../atlantis-common/atlantis-dev.s3.tfbackend]
          - plan:
              extra_args: [-var-file=dev.tfvars -var=atlantis_role_arn=arn:aws:iam::XXXXXXXX:role/atlantis_cross_account]
    prod:
      plan:
        steps:
          - run: rm -rf .terraform
          - init:
              extra_args: [-backend-config=prod.s3.tfbackend -backend-config=../atlantis-common/atlantis-prod.s3.tfbackend]
          - plan:
              extra_args: [-var-file=prod.tfvars -var=atlantis_role_arn=arn:aws:iam::XXXXXXXX:role/atlantis_cross_account]
I also have a python script that creates all the projects as pre_webhook job and they are named per environment:
Copy code
projects:
- name: argo_workflows_dev_saas
  dir: ./argo-workflows
  terraform_version: 1.6.6
  apply_requirements:
    - approved
    - mergeable

  workflow: dev
  autoplan:
    enabled: True
    when_modified:
    - '*.tf'
    - 'dev.*.tfbackend'
    - 'dev.tfvars'
    - 'modules/**/*.tf'
- name: argo_workflows_prod_saas
  dir: ./argo-workflows
  terraform_version: 1.6.6
  apply_requirements:
    - approved
    - mergeable

  workflow: prod
  autoplan:
    enabled: True
    when_modified:
    - '*.tf'
    - 'prod.*.tfbackend'
    - 'prod.tfvars'
    - 'modules/**/*.tf'
Not sure if that would work for you but could be a starting point