I’m a bit confused by this AWS “getter”: ```// Ge...
# general
b
I’m a bit confused by this AWS “getter”:
Copy code
// GetOpenIdConnectProvider gets an existing OpenIdConnectProvider resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetOpenIdConnectProvider(ctx *pulumi.Context,
	name string, id pulumi.IDInput, state *OpenIdConnectProviderState, opts ...pulumi.ResourceOption) (*OpenIdConnectProvider, error) {
	var resource OpenIdConnectProvider
	err := ctx.ReadResource("aws:iam/openIdConnectProvider:OpenIdConnectProvider", name, id, state, &resource, opts...)
	if err != nil {
		return nil, err
	}
	return &resource, nil
}
If feels like the
state
argument is redundant… since this function requires the resource
id
which I’m assuming this would make this unique. What’s the point of the
state
arg?
l
No idea. It's the same share for all the getters. The ID is mandatory, so why have a state parameter to filter it down? The most it can do is reduce the number of results from 1 to 0...
I have always left that parameter out, it has never complained (in the TS version).
b
well, what really sucks is that I’d like to filter, possibly within the id
but it seems there are some explicit getters made for that, that return multiple items based on the filter
l
Yes, the get function is intended to be "get one and only one".