You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Upgrading provider version causes a terraform plan on merge commit message/title #1295
Opening an issue on behalf of @danielpops and @chaosaffe from discussion in #1263. This would have began as of v4.31.0.
This PR causes a plan like so to be generated on repositories:
# github_repository.repo["the_repo"] will be updated in-place
~ resource "github_repository" "repo" {
id = "the_repo"
+ merge_commit_message = "PR_TITLE"
+ merge_commit_title = "MERGE_MESSAGE"
name = "the_repo"
+ squash_merge_commit_message = "COMMIT_MESSAGES"
+ squash_merge_commit_title = "COMMIT_OR_PR_TITLE"
# (28 unchanged attributes hidden)
}
Presumably this plan may confuse users since it says something is going to happen, however the changes are simply setting new defaults and they are safe to apply.
@danielpops I think you're saying that the impact is that a plan is shown even though there is no effective change (the "new values" are simply the defaults, they just didn't exist in the tf state previously).
I don't know of a way to avoid terraform showing a plan difference here. Setting no default values would still display a plan like:
This seems like one of those unavoidable issues given how terraform currently tracks state, and I can't find a way to avoid it and still add properties to the repository object over time. If someone know of a better solution then I'm happy to take a look and implement it.
If preferred I can open a separate issue, as this doesn't fully encompass the issues we are experiencing.
The challenge on my side is that our org doesn't allow for merge or squash commits. The GH API doesn't allow setting defaults for merge and squash titles and messages while those merge types are disabled, putting us in a state where we are unable to upgrade the Github provider.
While the addition in the plan is inconvenient, adding a requirement for merge and squash defaults breaks the provider for anyone with merge or squash disabled on a repo.
FWIW, I'm also seeing the behaviour described. This is reminding me of the schema/state upgrade functionality the SDK provides -- I don't have time to dig into it now, but it seems like if the state is changing to have a new default, then an upgrader might be in order.
My apologies, I haven't had sufficient cycles to get back to this issue previously.
Unfortunately we encountered this bug merging a time-sensitive PR and had to pin to a previous version to avoid this issue. I'll make note to bump the provider and confirm the issue still exists.
For me this is fine, since I do not want to configure PR merge strategies or commit defaults with terraform at all. This fixed my plan, but I do not know what changes in state the provider does under the hood.
Perhaps this also fixes the case where merge or squash are explicitly disabled.
👋 Hey Friends, this issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please add the Status: Pinned label if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!
Activity
garrettheel commentedon Sep 20, 2022
@danielpops I think you're saying that the impact is that a plan is shown even though there is no effective change (the "new values" are simply the defaults, they just didn't exist in the tf state previously).
I don't know of a way to avoid terraform showing a plan difference here. Setting no default values would still display a plan like:
This seems like one of those unavoidable issues given how terraform currently tracks state, and I can't find a way to avoid it and still add properties to the repository object over time. If someone know of a better solution then I'm happy to take a look and implement it.
scruplelesswizard commentedon Oct 12, 2022
If preferred I can open a separate issue, as this doesn't fully encompass the issues we are experiencing.
The challenge on my side is that our org doesn't allow for merge or squash commits. The GH API doesn't allow setting defaults for merge and squash titles and messages while those merge types are disabled, putting us in a state where we are unable to upgrade the Github provider.
While the addition in the plan is inconvenient, adding a requirement for merge and squash defaults breaks the provider for anyone with merge or squash disabled on a repo.
garrettheel commentedon Oct 12, 2022
@chaosaffe I can't repro your issue. Here's what I tried:
allow_merge_commit = falseandallow_squash_merge = falseFor me, the above applies successfully. Is there something I'm missing as far as reproducing?
foosinn commentedon Oct 14, 2022
hey @garrettheel,
i find it odd that updating changes the repositories.
Do the displayed changes cause changes on the github repos?
isaacsanders commentedon Oct 19, 2022
https://docs.github.com/en/rest/repos/repos#create-an-organization-repository
rsrchboy commentedon Feb 13, 2023
FWIW, I'm also seeing the behaviour described. This is reminding me of the schema/state upgrade functionality the SDK provides -- I don't have time to dig into it now, but it seems like if the state is changing to have a new default, then an upgrader might be in order.
https://pkg.go.dev/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema#StateUpgrader
scruplelesswizard commentedon Mar 22, 2023
My apologies, I haven't had sufficient cycles to get back to this issue previously.
Unfortunately we encountered this bug merging a time-sensitive PR and had to pin to a previous version to avoid this issue. I'll make note to bump the provider and confirm the issue still exists.
chemmi commentedon Mar 30, 2023
As a workaround I ignored changes in the corresponding fields.
For me this is fine, since I do not want to configure PR merge strategies or commit defaults with terraform at all. This fixed my plan, but I do not know what changes in state the provider does under the hood.
Perhaps this also fixes the case where merge or squash are explicitly disabled.
@chaosaffe
scruplelesswizard commentedon Apr 21, 2023
@chemmi thanks for that workaround!
github-actions commentedon Jun 19, 2024
👋 Hey Friends, this issue has been automatically marked as
stalebecause it has no recent activity. It will be closed if no further activity occurs. Please add theStatus: Pinnedlabel if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!