runatlantis / atlantis

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

Atlantis Plan Specific Workflow #1271

Open ginski47 opened 3 years ago

ginski47 commented 3 years ago

hi i am interested in running an atlantis plan only on projects that have a specific workflow. I know atlantis plan and autoplan run it on any modified projects or files - but some of my tf files have a different workflow than others. i.e. dev , test or prod workflow.

can i somehow alter atlantis plan to read atlantis plan dev @lkysow ?

this is my yaml file below: i tried to create a plan all-dev project with when_modified which would only run projects with the specific workflow of dev but it cant find the tfvars files...my workspace is the same - default

# atlantis.yaml
---
version: 3

projects:
- name: all-dev
  dir: .
  workflow: dev
  autoplan:
    when_modified: ["**/*.tf","**/*.tf*"]
    enabled: false
- name: test-atlantis-dev
  dir: test1
  workflow: dev
- name: test-atlantis-dev2
  dir: test2
  workflow: dev

This looks a lot like Issue #961 or event this #874

my file structure looks like this:

.
├── test-atlantis-dev
│   └── main.tf
│   ├── outputs.tf
│   ├── variables.tf
│   ├── backend-config.tf
│      └── dev.tfvars
│      ├── test.tfvars
│   ├── env-config.tf
│      └── dev.tfvars
│      ├── test.tfvars
├── test-atlantis-dev2
│   └── main.tf
│   ├── outputs.tf
│   ├── variables.tf
│   ├── backend-config.tf
│      └── dev.tfvars
│      ├── test.tfvars
│   ├── env-config.tf
│      └── dev.tfvars
│      ├── test.tfvars
└── atlantis.yaml
ginski47 commented 3 years ago

in a nutshell, im trying to add another option where one can add atlantis plan -workflow and it would run all the projects with a specific workflow. similar to what we have for dir, project, workspaces in here: https://www.runatlantis.io/docs/using-atlantis.html#atlantis-plan

ginski47 commented 3 years ago

Hello, could the team make this a feature on the atlantis plan or autoplan feature?

I currently have a directory . And in it: Project 1, 2 and 3 all use dev workflow. Project 4 just uses test workflow.

When I atlantis plan id like to only run the projects with dev workflow. Sometimes id like to atlantis plan only the projects with test workflow.

Similar to how we have flags for atlantis plan -d -p -w can we have a flag to only plan projects which have specific workflows

jamengual commented 2 years ago

PRs are welcome

leodamasceno commented 1 year ago

+1

ebuildy commented 8 months ago

Hey!

I did quickly this PR https://github.com/runatlantis/atlantis/pull/4029 , not tested yet, still working on it