-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Autoplan issue with terraform 0.12 and terragrunt 0.19 #728
Comments
My directory structure for files modified in this
|
I don't think you need a client-side config. You should rather use a server-side repo config. I use the same tools and versions as you, here is what works for me:
With this config, autoplan works fine. The only bug is that it also detects the root terragrunt config file and tries to plan it. |
Have you migrated all the files to new My # repos lists the config for specific repos.
repos:
# id can either be an exact repo ID or a regex.
# If using a regex, it must start and end with a slash.
# Repo ID's are of the form {VCS hostname}/{org}/{repo name}, ex.
# github.com/runatlantis/atlantis.
- id: /.*/
# apply_requirements sets the Apply Requirements for all repos that match.
apply_requirements: [approved, mergeable]
# workflow sets the workflow for all repos that match.
# This workflow must be defined in the workflows section.
workflow: default
# allowed_overrides specifies which keys can be overridden by this repo in
# its atlantis.yaml file.
allowed_overrides: []
# allow_custom_workflows defines whether this repo can define its own
# workflows. If false (default), the repo can only use server-side defined
# workflows.
allow_custom_workflows: false
# workflows lists server-side custom workflows
workflows:
default:
plan:
steps:
- run: terragrunt plan -no-color -out "${PLANFILE}"
apply:
steps:
- run: terragrunt apply -no-color "${PLANFILE}" |
No I am still in the process, but the migrated files are properly discovered and planned.
Your config looks fine indeed. |
@ldormoy I used your configuration but still have the same issue. I tested all combinations with and without |
I went trough @ldormoy you can check by yourself whether https://github.com/runatlantis/atlantis/blob/master/server/events/project_finder.go#L120-L131 // filterToTerraform filters non-terraform files from files.
func (p *DefaultProjectFinder) filterToTerraform(files []string) []string {
var filtered []string
for _, fileName := range files {
// Filter out tfstate files since they usually checked in by accident
// and regardless, they don't affect a plan.
if !p.isStatefile(fileName) && strings.Contains(fileName, ".tf") {
filtered = append(filtered, fileName)
}
}
return filtered
} It was only working with When I have changed following condition and run - if !p.isStatefile(fileName) && strings.Contains(fileName, ".tf") {
+ if !p.isStatefile(fileName) && (strings.Contains(fileName, ".tf") || strings.Contains(fileName, ".hcl")) {
filtered = append(filtered, fileName)
} |
oops you are right, I have the same problem. @lkysow looks like @milpog change could be a solution? If we go this way, could it be possible to use this opportunity to tackle the root terragrunt configuration issue?
The frontend and backend |
That function isn't used when Also, it starts looking in the directory specified in your project setting. If you want it to find .hcl files that are further below that directory you need to specify that:
|
@lkysow it looks like
but instead of running
|
That's expected behaviour. You need to configure the root of each Terraform project as a directory. It sounds like you need:
Terraform projects are not multi-directory, that's why it's built this way. |
@lkysow Thanks for the clarification. I've been having the same issue when trying to setup Atlantis with Terragrunt for the first time. Really wish we weren't using Terragrunt right now. I have a lot of |
@lkysow would you consider implementing solution I proposed in #728 (comment) or something similar but in line with your vision of developing We will probably fork |
I am looking at the same issue. I would like it to pick up that .hcl files changed and not just tf files without have to specify per directory. I don't see a way to set this in the server side config |
@milpog - maybe you guys can consider making this configurable? Have the default be how it is now, thus changing nothing, but allow you to configure it to pick up .hcl files (or any other type of files that someone may want to configure it to autoplan on). |
I think a top-level |
Just abstract the current autoplan logic. Maybe that's what the |
This was closed by #748 |
I am trying to use
atlantis 0.8.3
withterraform 0.12.6
andterragrunt 0.19.16
and I am facing an issue withautoplan
functionality.Terragrunt
from version0.19.x
is usingterragrunt.hcl
files instead ofterraform.tfvars
. After migration nothing isauto planned
as it was previously.I was even trying to use
atlantis.yaml
but apparently I cannot figure out how to set it up properly. I tried following configuration but I am still receiving information that no project was suitable for plan.First approach
Logs
Second approach
Logs
Thanks for help!
The text was updated successfully, but these errors were encountered: