-
Notifications
You must be signed in to change notification settings - Fork 769
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 ruleset bypass actors diff issues #1950
Conversation
I looked into the inability to remove bypass actors by removing the block(s) and it doesn't seem like something that's fixed through the provider's implementation. Please correct me if my thinking below is wrong. bypass actors is a list of objects, each is a block in TF, this create a slice of type
E.g. I looked into the debug logs and this is the ruleset in the request sent from the provider to the API:
I will test out my theory and if needed, make a PR to |
That sounds great, thank you @o-sama! We appreciate all your contributions. |
I randomly stumbled upon this issue myself last week in jdamata/terraform-provider-sonarqube#211. I started out with defining the I'm not sure what implications there would be in switching to the set now that From most of the Terraform providers I've looked into so far (including this one), it seems that |
I remember when we worked on this initially I saw Similarly I wasn't aware this would be an issue to be honest and so it seems like it would be fine. In hindsight it'd have been better to use I am interested though in why it is underused compared to |
Ye I'm in the same camp. I'd never used the set for a nested schema before last week, and I'm confused as to why it's not used more. Maybe I'll find out in a month when I curse myself for using it in the SonarQube provider 😅 |
@o-sama where did you land on the go-github PR? What does that mean for this PR? I'd like to check just to make sure this doesn't get forgetten. |
What needs to happen before we can get this addressed? We're currently seeing a constant churn on both the |
@kfcampbell I was tied up between work and a different feature in go-github and haven't implemented the change I mentioned yet. I've worked on it locally but I just have to add test cases and push my changes for review. I think the PR as is should fix the diff issue but it wouldn't add the ability to remove bypass actors since as far as I'm aware the client lacks that ability still. I've been abroad for the last week or so but should have some time to work on that in the next couple of days. My bad on the delay! |
Thanks for your effort on this, @o-sama! Please let me know if there's anything you need help with. 🙏 |
@kfcampbell & @nickfloyd Apologies for the delay here, It's been a hectic couple of months for me. I'm going to be creating the PR on I'll have to revisit my notes but IIRC once I get the |
@o-sama Sounds good! When that's merged, we can also clean up the diff suppress functions introduced here. |
@kfcampbell The diff suppress func will likely need to stay since this issue comes from the default diff func comparing the objects as a string one line at a time, so you'd likely always have a diff. I'll try changing that to a set at some point and having a state migration func to handle the change without needing anything on the users' end, how does that sound? By the way thank you for the release! Always appreciate your timely responses! |
Ahh, thanks for clarifying. That sounds good to me! I'm grateful for your contributions to this project. |
Co-authored-by: Keegan Campbell <[email protected]>
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [github](https://registry.terraform.io/providers/integrations/github) ([source](https://togithub.com/integrations/terraform-provider-github)) | required_provider | minor | `5.44.0` -> `5.45.0` | --- ### Release Notes <details> <summary>integrations/terraform-provider-github (github)</summary> ### [`v5.45.0`](https://togithub.com/integrations/terraform-provider-github/releases/tag/v5.45.0) [Compare Source](https://togithub.com/integrations/terraform-provider-github/compare/v5.44.0...v5.45.0) #### What's Changed - build(deps): bump golang.org/x/crypto from 0.17.0 to 0.18.0 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/integrations/terraform-provider-github/pull/2098](https://togithub.com/integrations/terraform-provider-github/pull/2098) - build(deps): bump golang.org/x/oauth2 from 0.15.0 to 0.16.0 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/integrations/terraform-provider-github/pull/2097](https://togithub.com/integrations/terraform-provider-github/pull/2097) - docs: Adds description for overwrite_on_create option. by [@​Nmishin](https://togithub.com/Nmishin) in [https://github.com/integrations/terraform-provider-github/pull/2095](https://togithub.com/integrations/terraform-provider-github/pull/2095) - docs: Update branch protection documentation by [@​LiamMacP](https://togithub.com/LiamMacP) in [https://github.com/integrations/terraform-provider-github/pull/2085](https://togithub.com/integrations/terraform-provider-github/pull/2085) - feat: Add `required_workflows` to `github_organization_ruleset` by [@​relusc](https://togithub.com/relusc) in [https://github.com/integrations/terraform-provider-github/pull/2082](https://togithub.com/integrations/terraform-provider-github/pull/2082) - Fix ruleset bypass actors diff issues by [@​o-sama](https://togithub.com/o-sama) in [https://github.com/integrations/terraform-provider-github/pull/1950](https://togithub.com/integrations/terraform-provider-github/pull/1950) #### New Contributors - [@​LiamMacP](https://togithub.com/LiamMacP) made their first contribution in [https://github.com/integrations/terraform-provider-github/pull/2085](https://togithub.com/integrations/terraform-provider-github/pull/2085) **Full Changelog**: integrations/terraform-provider-github@v5.44.0...v5.45.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://togithub.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xNzQuMyIsInVwZGF0ZWRJblZlciI6IjM3LjE3NC4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> Co-authored-by: kireque-bot[bot] <143391978+kireque-bot[bot]@users.noreply.github.com>
Resolves #1952 (Partial)
Before the change?
I've seen this happen when the order in which
bypass_actor
blocks happen to be defined changes. Whether this is done manually or through an automation (I've noticed this happen with something I'm working on which uses a yaml file for defining things).A while back I made a small change which tries to fix this by sorting when flattening the block, but that doesn't cover this case (and potentially others) and isn't technically the way to do it.
After the change?
The following is the same change as above:
Pull request checklist
Does this introduce a breaking change?
Please see our docs on breaking changes to help!