Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Change in file in modules directory not detected #588

Closed
ibottabt opened this issue Apr 11, 2019 · 4 comments
Closed

Change in file in modules directory not detected #588

ibottabt opened this issue Apr 11, 2019 · 4 comments
Labels
question Further information is requested

Comments

@ibottabt
Copy link

> atlantis version
atlantis 0.4.15

Atlantis is not detecting changes in module files. This was already reported in hootsuite/atlantis#188 and apparently fixed in hootsuite/atlantis#211, but I'm not seeing the desired behavior.

For example, given the directory structure below, if I make a change to terraform/modules/variables.tf, push and do a PR, Atlantis is not triggered. Commenting atlantis apply -d terraform detects the change and does what I would expect Atlantis to do automatically.

Making a change to terraform/atlantis-test-01.tf does what I expect and runs a new plan.

.
└── terraform
    ├── atlantis-test-01.tf
    ├── modules
    │   └── atlantis-test-01
    │       ├── README.md
    │       ├── main.tf
    │       ├── outputs.tf
    │       └── variables.tf
    ├── providers.tf
    └── vars.tf

This seems relevant:

2019/04/11 15:08:02+0000 [INFO] working_dir.go:122 zzz/atlantis-test-01#15: Creating dir "/atlantis-data/repos/zzz/atlantis-test-01/15/default"
2019/04/11 15:08:04+0000 [DBUG] working_dir.go:180 zzz/atlantis-test-01#15: Ran: git clone --branch change-tet --depth=1 --single-branch https://github.com/zzz/atlantis-test-01.git /atlantis-data/repos/zzz/atlantis-test-01/15/default. Output: Cloning into '/atlantis-data/repos/zzz/atlantis-test-01/15/default'...
2019/04/11 15:08:04+0000 [INFO] project_command_builder.go:114 zzz/atlantis-test-01#15: Found no atlantis.yaml file
2019/04/11 15:08:04+0000 [DBUG] project_command_builder.go:122 zzz/atlantis-test-01#15: 1 files were modified in this pull request
2019/04/11 15:08:04+0000 [INFO] project_finder.go:51 zzz/atlantis-test-01#15: Filtered modified files to 1 .tf files: [terraform/modules/atlantis-test-01/variables.tf]
2019/04/11 15:08:04+0000 [INFO] project_finder.go:72 zzz/atlantis-test-01#15: There are 0 modified project(s) at path(s):
2019/04/11 15:08:04+0000 [INFO] project_command_builder.go:131 zzz/atlantis-test-01#15: Automatically determined that there were 0 projects modified in this pull request: []
2019/04/11 15:08:04+0000 [INFO] command_runner.go:104 zzz/atlantis-test-01#15: Determined there was no project to run plan in
@lkysow
Copy link
Member

lkysow commented Apr 11, 2019

It will only plan in terraform/ if there is a main.tf file, rename atlantis-test-01.tf to main.tf and it will work.

@lkysow lkysow added the question Further information is requested label Apr 11, 2019
@timoguin
Copy link
Contributor

You can also add an atlantis.yaml that specifies relative paths outside the project directory to trigger autoplan on. Here's an example that we use.

version: 2
projects:
- dir: tf/prod
  autoplan:
    when_modified:
      - "*.tf"
      - "*.tfvars"
      - "*.tpl"
      - "../*.tf"
      - "../modules"
    enabled: true
  apply_requirements: []

This allows us to symlink common .tf files into multiple directories, as well as share modules between projects, so we can trigger autoplans any time we update those common files.

@lkysow
Copy link
Member

lkysow commented Apr 12, 2019

Yeah, if the auto detection doesn't work then you'll have to use the when_modified config.

But you should be fine just calling that file main.tf.

@lkysow lkysow closed this as completed Apr 12, 2019
@ibottabt
Copy link
Author

Renaming to main.tf works - thanks @lkysow!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants