[BUG] Enable importing github_emu_group_mapping for Group with multiple teams#3054
Conversation
|
👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with |
github_emu_group_mapping for Group with multiple teams
beb7f4d to
abb3de3
Compare
stevehipwell
left a comment
There was a problem hiding this comment.
As we as the inline comments, we need to be careful when using tflog that it can only be used with contexts injected by TF (e.g. CreateContext).
abb3de3 to
a523161
Compare
a523161 to
e8cceb1
Compare
b572afb to
5302481
Compare
stevehipwell
left a comment
There was a problem hiding this comment.
I've just realized what you're doing here, which is what I've been working on with the other team resources. I think you need to make the following changes (none of which I'd consider breaking).
- Resource ID format to
<team-id>:<team-slug>:<group-id>- State migration to update the ID
- Import to accept
<team-slug>:<group-id>- Lookup team ID and update resource ID to correct format
- Make group ID force new
- Otherwise changing the group would leave orphaned links
- Add custom diff function
- Force new if team slug points at new ID
- Separate create and update functions
The top 3 steps would be good enough to fix the bug and stop records being orphaned (unless the team slug was changed to point at a completely different team).
@stevehipwell These definitely sound like worthwhile changes, but I wonder if we need to do them before merging this? |
|
@deiga you need the first 2 steps above to fix the bug as otherwise you'll have duplicate IDs when teams have multiple groups attached. The 3rd step costs nothing and fixes another set of current defects. I think maybe we move this PR and the issue to the v6.11.0 milestone to give us a bit more time? |
@stevehipwell The ID uses team slug as the ID, so duplicate IDs shouldn't be an issue as each team can have exactly 1 mapping. Like I said, I'll happily address those in a follow-up as I don't see any of them necessary for getting this merged |
stevehipwell
left a comment
There was a problem hiding this comment.
Ok, at a bare minimum can we please only support two part import IDs. That way import doesn't have to lookup the team and we don't get any drift. It can save the original ID pattern for now and we can fix up the rest of my points later
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Which was found by our new tests! Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
3e24afb to
c853582
Compare
stevehipwell
left a comment
There was a problem hiding this comment.
Sorry @deiga I don't see how this resource works at all? The read just checks that the group has a team linked, not that the relationship is the one being managed by TF. It looks like the SDK is missing the required endpoint.
Let's push this PR into the next release. I'll open a PR to get the endpoint supported in the SDK.
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
stevehipwell
left a comment
There was a problem hiding this comment.
Thanks @deiga. This PR fixes the import bug and the other defects are pre existing so I think we should get it merged and fix the bugs in a separate PR.
Superseded #3043
Resolves #3030
Before the change?
github_emu_group_mappingAfter the change?
github_emu_group_mappingPull request checklist
Schema migrations have been created if needed (example)Does this introduce a breaking change?
Please see our docs on breaking changes to help!