-
Notifications
You must be signed in to change notification settings - Fork 544
fix(azure): Ensure spec subscriptions are unique #8099
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
Conversation
| return nil, fmt.Errorf("failed to unmarshal gcp spec: %w", err) | ||
| } | ||
|
|
||
| uniqueSubscriptions := funk.Uniq(spec.Subscriptions).([]string) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather use slices.Compact along with slices.Sort
| uniqueSubscriptions := funk.Uniq(spec.Subscriptions).([]string) | |
| uniqueSubscriptions := slices.Compact(slices.Sort(spec.Subscriptions)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(because it's a part of Go tooling & they're bringing this package to main stdlib as well)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one, but I'm not sure we should change the order of how subscriptions are defined in the spec, as I would expected CloudQuery to sync those in order (bound to concurrency limits)
|
Do we want to ensure the same thing on other plugins? (e.g., AWS, GCP) |
I think it's worth verifying it |
🤖 I have created a release *beep* *boop* --- ## [4.2.0](plugins-source-azure-v4.1.1...plugins-source-azure-v4.2.0) (2023-02-21) ### Features * **azure:** Add network ExpressRoute circuit authorizations and peerings ([#8128](#8128)) ([2d4cba5](2d4cba5)), closes [#7927](#7927) * **azure:** Add network: interface_ip_configurations and virtual_network_subnets ([#8126](#8126)) ([df5e48b](df5e48b)), closes [#7929](#7929) * **azure:** Add postgresql databases resource ([#8125](#8125)) ([91cab61](91cab61)), closes [#7928](#7928) ### Bug Fixes * **azure:** Ensure spec subscriptions are unique ([#8099](#8099)) ([20dc235](20dc235)) * **deps:** Update module github.com/cloudquery/plugin-sdk to v1.38.2 ([#8156](#8156)) ([ac2d2d7](ac2d2d7)) * **deps:** Update module golang.org/x/net to v0.7.0 [SECURITY] ([#8176](#8176)) ([fc4cef8](fc4cef8)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Related to #713. This PR detects duplicated client IDs, sends a sentry report when that happens and also logs a warning. It not this does not skip those clients (yet). I'll do a follow up based on the sentry data as we can have duplicate clients due to: 1. User errors creating a configuration that generates duplicated clients like in cloudquery/cloudquery#8099 2. Plugins bug, not implementing the ID method correctly ---
Summary
Fixes https://github.com/cloudquery/cloudquery-issues/issues/491 (internal issue)
Fixes https://github.com/cloudquery/cloudquery-issues/issues/492 (internal issue)
After looking at the data and sample responses:
https://learn.microsoft.com/en-us/rest/api/firewall/azure-firewall-fqdn-tags/list-all?tabs=HTTP
https://learn.microsoft.com/en-us/rest/api/expressroute/express-route-service-providers/list?tabs=HTTP#expressrouteserviceprovider, I think the PKs for these tables are configured correctly
(subscription_id,id)and can't cause duplicates as far as I can tell.However I was able to reproduce the issue by specifying a duplicate subscription in the config, for example: