https://www.runatlantis.io/ logo
Title
j

Justin S

05/05/2023, 1:57 PM
Anyone know how to make Atlantis handle a folder structure like this
  ~/trex/trex_ops_infra/dev/atlantis                                                                                                                                                                  09:56:46 AM
❯ tree
.
├── <http://backend.tf|backend.tf>
├── <http://data.tf|data.tf>
├── <http://iam.tf|iam.tf>
├── <http://local.tf|local.tf>
├── <http://main.tf|main.tf>
├── <http://namespace.tf|namespace.tf>
├── <http://provider.tf|provider.tf>
├── README.md
├── <http://secrets.tf|secrets.tf>
├── templates
│   └── values.yaml.tpl
└── <http://variables.tf|variables.tf>
works fine, except if you make a change to
values.yaml.tpl
since its not a .tf file its ignored. But if you add those files to the autoplan, atlantis attempts to run terraform from within the
templates
directory, which also is not correct.
p

PePe Amengual

05/05/2023, 4:33 PM
do you have a project defined?
j

Justin S

05/05/2023, 4:46 PM
The only thing defined, is a
repoconfig
repoConfig: |
 ---
 repos:
 - id: /.*/
   apply_requirements: [mergeable]
   import_requirements: [mergeable]
p

PePe Amengual

05/05/2023, 5:05 PM
I think you need a project define where you define the dir and autoplan so that it always uses that dir instead
j

Justin S

05/05/2023, 5:15 PM
I do not think that would work
we are in a mono repo.
breaking it out, makes Atlantis not really worth the investment
p

PePe Amengual

05/05/2023, 5:16 PM
I have a monorepo but I define all projects dynamically
j

Justin S

05/05/2023, 5:18 PM
so we look like this..
  ~/trex/trex_ops_infra   dev_cw_prio *1                                                                                                                                                                                     01:17:55 PM
❯ tree -L 2
.
├── bastion-config
├── dev
│   ├── atlantis
│   ├── cluster
│   ├── core-applications
│   ├── gitlab
│   ├── jenkins
│   ├── network
│   └── vault
├── Pipfile
├── Pipfile.lock
├── prod
│   ├── acm
│   ├── atlantis
│   ├── cluster
│   ├── core-applications
│   ├── gitlab
│   ├── jenkins
│   ├── network
│   └── vault
├── remote_access.md
└── ssh-ssm.sh
but some of those folders, have sub-folders as well
so im not sure how we would define that
w

wby

05/06/2023, 12:07 AM
one way, if I’m understanding the question correctly and you’re using a repo config:
projects:
  - dir: dev/atlantis
  - dir: dev/cluster
[...]
  - dir: prod/acm
[...]
  - dir: prod/gitlab/some/other/state
j

Justin S

05/08/2023, 1:29 PM
@PePe Amengual care to elaborate on how you do it, dynamically? because writing it all out like the above would be a lot of effort. Since some of those folders are layers deep.
one way of doing it
using pre_workflow_hooks
you can run any script to generate your atlantis.yaml