Skip to content
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

performance improvements on mount fetch #2152

Merged
merged 11 commits into from
Feb 26, 2024
31 changes: 22 additions & 9 deletions vault/data_source_auth_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,28 @@ func authBackendDataSourceRead(d *schema.ResourceData, meta interface{}) error {

path = strings.TrimSuffix(path, "/")
d.SetId(path)
d.Set("type", auth.Type)
d.Set("description", auth.Description)
d.Set("accessor", auth.Accessor)
d.Set("default_lease_ttl_seconds", auth.Config.DefaultLeaseTTL)
d.Set("max_lease_ttl_seconds", auth.Config.MaxLeaseTTL)
d.Set("listing_visibility", auth.Config.ListingVisibility)
d.Set("local", auth.Local)
return nil

// If we fell out here then we didn't find our Auth in the list.
if err := d.Set("type", auth.Type); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want the error checks for d.Set to be ignored, it seems like we can set up an exclusion: https://github.com/golangci/golangci-lint/blob/master/.golangci.reference.yml#L266-L299

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I think we should probably enforce error checking in this case just to be safe.

return err
}
if err := d.Set("description", auth.Description); err != nil {
return err
}
if err := d.Set("accessor", auth.Accessor); err != nil {
return err
}
if err := d.Set("default_lease_ttl_seconds", auth.Config.DefaultLeaseTTL); err != nil {
return err
}
if err := d.Set("max_lease_ttl_seconds", auth.Config.MaxLeaseTTL); err != nil {
return err
}
if err := d.Set("listing_visibility", auth.Config.ListingVisibility); err != nil {
return err
}
if err := d.Set("local", auth.Local); err != nil {
return err
}

return nil
}
Loading