-
Notifications
You must be signed in to change notification settings - Fork 764
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
Upgrading provider version causes a terraform plan on merge commit message/title #1295
Comments
@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. |
@chaosaffe I can't repro your issue. Here's what I tried:
For me, the above applies successfully. Is there something I'm missing as far as reproducing? |
hey @garrettheel, i find it odd that updating changes the repositories. Do the displayed changes cause changes on the github repos? |
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 |
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. |
As a workaround I ignored changes in the corresponding fields. lifecycle {
ignore_changes = [
merge_commit_message,
merge_commit_title,
squash_merge_commit_message,
squash_merge_commit_title,
]
} 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 |
@chemmi thanks for that workaround! |
👋 Hey Friends, this issue has been automatically marked as |
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:
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.
The text was updated successfully, but these errors were encountered: