-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Allow creation of UDFs in a dataset #4493
Allow creation of UDFs in a dataset #4493
Comments
Thanks for filing this. Essentially Routines (at the API level) are a meta-collection for different kinds of function-like resources. As you've noted, user-defined functions are one aspect, but other kinds of things map into this concept like stored procedures and table-valued functions. Is the general preference of the terraform community to have different kinds of resources exposed (e.g. google_bigquery_udf, google_bigquery_procedure, etc) or to adhere closer to the API and expose a more generic google_bigquery_routine resource with optional fields that aren't relevant for all kinds of routines? Main precedent among bigquery resources here is that currently google_bigquery_table can be used to create managed tables, logical views, and federated tables that reference external resources. The other thing that's going to be interesting is expressing the data typing of inputs and outputs. The common case is something like the scalar syntax here, but BQ's ability to use structs and arrays means that typing is more complex, and it may make more sense to do the same "just use a json string" technique as used for expressing schemas in table resources. |
So, it seems like I'm seeing a few questions here:
So I think there's a trade-off here. Specifically, if you have multiple resources for each case, the Terraform API differs more from the corresponding Google API, and will increase the maintenance burden, since there are now more resources to maintain. The other side of the coin is that having a single resource for all of these that requires different parameters that are required/not depending on the circumstance makes it less clear to users what is actually needed to define any particular one of these three, and makes it more likely when users are building these that issues won't be caught during the Terraform planning phase and will instead be noticed when applies are run and they fail. This is, of course, not a great user experience. The main thing that would make a decision more clear is how different each of these is when you request against the Routine API defined here. If they require much different configurations in practice, I'd argue it makes more sense to split them up into separate resources. The opposite if they mostly require the same set of parameters. Unfortunately I wasn't able to find documentation like the following for stored procedures or table-valued functions beyond a very cursory mention of stored procedures here after searching the BigQuery docs. If you happen to have more clear documentation somewhere that I missed on how these differ in practice it'd make this call easier.
Yeah, I'd agree. I wasn't really thinking about that at the time of creating this issue. We could use JSON that hews closer to the Argument definition instead of using the |
Bringing over the points I made on #4619 which @paddycarver has (rightly) closed as a duplicate. This may add discussion to the points that @chetaldrich raised above.
|
Regarding whether to have a single Terraform resource or multiple resources for stored procs, functions - the existing |
I was curious about this feature and looked at generating the resource via |
Hi all, does Terraform give us a release date or do we have to get enough 👍 ? |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks! |
Community Note
Description
I was looking for something that might allow me to define a UDF inside a Google Cloud BigQuery dataset, and wasn't able to find anything in the provider at present. It seems like the Go client library allows for creation of these by creation of a Routine, defined here.
It might be worthwhile to consider adding this functionality to the module considering they can now be defined in a persistent manner (see this)
New or Affected Resource(s)
Potential Terraform Configuration
I'm not confident this covers all the potential knobs that you can turn, but I think it covers the ones mentioned here.
References
The text was updated successfully, but these errors were encountered: