Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Exclude directory without defining all directories in atlantis.yaml #859

Open
jseiser opened this issue Nov 26, 2019 · 2 comments
Open

Exclude directory without defining all directories in atlantis.yaml #859

jseiser opened this issue Nov 26, 2019 · 2 comments
Labels
feature New functionality/enhancement Stale

Comments

@jseiser
Copy link

jseiser commented Nov 26, 2019

I found an old github entry, that made this seem possible, but it appears its changed.

Is there a way to exclude a directory, that doesn't require listing every directory in atlantis.yml?

We are wanting non-engineers to be able to easily create their new environments via a pull request. So we will not know ahead of time, what 'projects' would exist at any given time.

Folder structure is like the below. _modules folder, example folder inside which is a almost 99% complete deployment, user just needs to create a folder at the root level, copy those files in and change the backed settings. I never need to plan or run on this folder.

Even the option to exclude this directory, but include all other directories based on some sort of regex would be great. like ignore _module, but include any project starting with deploy_ etc.

 └── _modules
    └── app_tenant
        ├── credentials.tf
        ├── data.tf
        ├── examples
        │   ├── data.tf
        │   ├── main.tf
        │   └── setup.tf
        ├── iam.tf
        ├── kms-key.tf
        ├── mysql.tf
        ├── outputs.tf
        ├── s3.tf
        ├── templates
        │   ├── policy-kms.tpl
        │   ├── policy-s3.tpl
        │   └── policy-tenant-kms.tpl
        └── variables.tf

@lkysow
Copy link
Member

lkysow commented Nov 27, 2019

Hi Justin, this is not possible right now. Every directory needs to be defined.

@lkysow lkysow added the feature New functionality/enhancement label Nov 27, 2019
@nitrocode nitrocode changed the title [FEATURE] Black List Feature Exclude directory without defining all directories in atlantis.yaml Jan 16, 2023
@nitrocode
Copy link
Member

nitrocode commented Jan 16, 2023

Currently the only way to do it would be to programmatically generate atlantis.yaml in a pre-workflow-run.

See projects like

You can also use a custom shell script to do this since the atlantis.yaml file is read on-the-fly.


Going forward, it would be handy to maybe have an atlantis.yaml interface like this

# proposal
autodiscover:
  enabled: true
  ignore:
    - "^_modules/.*"

# proposal: for all autodiscovered projects
project_defaults:
- workspace: default
  workflow: default
  autoplan:
    when_modified: ["*.tf", "../modules/**/*.tf"]
    enabled: true

# override autodiscovered projects matching the same
# combination of `dir`, `workspace`, `workflow`
projects:
- dir: terraform/nlb
  workspace: default
  workflow: default
  name: terraform/nlb
  autoplan:
    enabled: false

(all projects key ref)

This way we can set the defaults for ALL projects discovered and then override specific projects to ignore autoplanning.

In slack, @krrrr38 suggested an additional key called autodiscover to ignore specific paths

autodiscover:
  ignore_paths:
    - "^_modules$"

it would be good to study env0, spacelift, and terrateam to see what their interface is and how they solve this problem

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
feature New functionality/enhancement Stale
Projects
None yet
Development

No branches or pull requests

3 participants