-
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
fix: auto plan when .terraform.lock.hcl changed #3473
fix: auto plan when .terraform.lock.hcl changed #3473
Conversation
This can be done in the default or custom workflow by changing the autoplan triggered files or https://www.runatlantis.io/docs/server-configuration.html#autoplan-file-list, why to change it in atlantis code? |
Thank you, I didn't know that feature. But I think it's a good default. I was surprised that Atlantis didn't run auto plan when the lock file was changed. |
This default does not work for a lot of people that do not commit the lock file, that is the problem. |
Tests are failing and no new tests have been added in this pr for coverage. What cases would someone only update the lock file and not the hcl files themselves? |
I usually set relatively relaxed version constraints on HCL and exact versions are set by
When I update provider versions by If this makes sense, I'd like to fix/add tests to cover the new scenario where only |
227b1ef
to
7354064
Compare
To me, your change makes sense. Thank you for contributing. My only issue is the lack of tests. cc: @jamengual @GenPage thoughts? |
it is fine with me as long as there are tests. |
Could you help me to write tests? I found atlantis/server/controllers/events/events_controller_e2e_test.go Lines 705 to 718 in 0231970
.terraform.lock.hcl runs the auto-plan. But atlantis v0.24 won't run auto-plan when only .terraform.lock.hcl is modified. Am I missing something?
|
7354064
to
92fc89b
Compare
e6a51d5
to
7c72247
Compare
46fa8fe
to
7c72247
Compare
5036dd3
to
c151c7d
Compare
c151c7d
to
7b7289f
Compare
@nitrocode I added a unit test and updated the PR description. Can you take a look? |
Problem When `projects` are specified and `when_modified` is not specified via the config file, changing `.terraform.lock.hcl` file won't trigger auto plan. This is because the default `raw.WhenModified` does not include `.terraform.lock.hcl`. Note that when projects are auto detected, changing `.terraform.lock.hcl` triggers auto plan. This is because the `cmd.DefaultAutoplanFileList` includes `.terraform.lock.hcl`. Solution Include `.terraform.lock.hcl` to the default `raw.WhenModified`.
7b7289f
to
b1e3183
Compare
Thank you for the contribution @shouichi |
Problem When `projects` are specified and `when_modified` is not specified via the config file, changing `.terraform.lock.hcl` file won't trigger auto plan. This is because the default `raw.WhenModified` does not include `.terraform.lock.hcl`. Note that when projects are auto detected, changing `.terraform.lock.hcl` triggers auto plan. This is because the `cmd.DefaultAutoplanFileList` includes `.terraform.lock.hcl`. Solution Include `.terraform.lock.hcl` to the default `raw.WhenModified`.
Problem When `projects` are specified and `when_modified` is not specified via the config file, changing `.terraform.lock.hcl` file won't trigger auto plan. This is because the default `raw.WhenModified` does not include `.terraform.lock.hcl`. Note that when projects are auto detected, changing `.terraform.lock.hcl` triggers auto plan. This is because the `cmd.DefaultAutoplanFileList` includes `.terraform.lock.hcl`. Solution Include `.terraform.lock.hcl` to the default `raw.WhenModified`.
Problem When `projects` are specified and `when_modified` is not specified via the config file, changing `.terraform.lock.hcl` file won't trigger auto plan. This is because the default `raw.WhenModified` does not include `.terraform.lock.hcl`. Note that when projects are auto detected, changing `.terraform.lock.hcl` triggers auto plan. This is because the `cmd.DefaultAutoplanFileList` includes `.terraform.lock.hcl`. Solution Include `.terraform.lock.hcl` to the default `raw.WhenModified`.
what
When
projects
are specified andwhen_modified
is not specified viathe config file, changing
.terraform.lock.hcl
file won't trigger autoplan. This is because the default
raw.WhenModified
does not include.terraform.lock.hcl
.Note that when projects are auto detected, changing
.terraform.lock.hcl
triggers auto plan. This is because thecmd.DefaultAutoplanFileList
includes.terraform.lock.hcl
.why
It is desirable to run terraform plan/apply even if only
.terraform.lock.hcl
are updated.tests
I added a unit test and also tested this behavior by running atlantis with this change.
references
See also #3466.