-
Notifications
You must be signed in to change notification settings - Fork 81
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
Swap out internal client for new external client - SAML Groups #123
base: master
Are you sure you want to change the base?
Conversation
e1b2075
to
3a20107
Compare
err := (*provider.Client).UpdateAdminSAMLGroups(d.Id(), adminSAMLGroupsObj) | ||
err := (*provider.Client).UpdateAdminSAMLGroups(d.Get("name").(string), adminSAMLGroupsObj) |
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 the legacy functions expected the Id to be the name, avoid potential issues caused by inconsistency between the two providers by always using the name
when updating/deleting SAML groups.
resp, err := (*provider.Client).DeleteAdminSAMLGroups(d.Id()) | ||
resp, err := (*provider.Client).DeleteAdminSAMLGroups(d.Get("name").(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.
Because the legacy functions expected the Id to be the name, avoid potential issues caused by inconsistency between the two providers by always using the name
when updating/deleting SAML groups.
54f7a69
to
858cabb
Compare
7dab85d
to
8ea0202
Compare
splunk/entry_crud.go
Outdated
// GetOk only returns true if the fetched value is not the zero value for its type, | ||
// so we can only determine if use_legacy_client was explicitly true. but because | ||
// true is our default value, we know that it can only be false if explicitly set. | ||
if ok || !resourceLegacyClient { | ||
return resourceLegacyClient | ||
} |
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'm working to validate this comment and logic is correct, after behavior I saw while testing similar code yesterday.
ab80dd7
to
c54de7b
Compare
c54de7b
to
b55ed6f
Compare
b55ed6f
to
ee7b2b4
Compare
This PR is the start of the migration from the internally-included Splunk client for the newly available external client. The external client is added alongside the legacy client, and can be used by setting either the appropriate provider (
use_client_default
) or resource (use_client
) configuration toexternal
.The external client handles CRUD operations with standard Create/Read/Update/Delete functions, which deduplicates a lot of code, and provides a single location to implement fixes when issues are discovered. Migrating this Terraform provider to use it should solve a lot of the error handling and drift issues currently present.
The interesting work is found in 5a34349, which adds composable CRUD function creation, simplifying logic and reducing repetition.
The remaining commits are in support of this swap.
As this PR adds the ability to use the external client, but by default does not change existing behavior, it can be merged and tagged without a major version bump. After all existing resources permit use of the external client, a new PR can be submitted to make the default behavior to use the external client, which would justify a major version bump.