GKE supports resource usage metering right now. It'd be great if Terraform supported configuring this option as well. Otherwise, we have to manually enable or disable it. Manually configuring it means it's prone to human error and isn't declarative or versioned.
resource "google_container_cluster" "primary" {
resource_usage_bigquery_dataset <name of BigQuery dataset>
}
Not specifying resource_usage_bigquery_dataset means it's disabled.
None
Can do, as long as it's featured in the API... but I can't find any evidence that it is. Looks gcloud exclusive according to the docs here: https://cloud.google.com/kubernetes-engine/docs/how-to/cluster-usage-metering. I'll keep looking.
Aha, yes:
You cannot currently enable usage metering using the Google Cloud Platform Console.
So it's gcloud-exclusive - if you want it in Terraform, for now you'll need to use provisioners or null resources which shell out to gcloud to set it up. Tagging as upstream for reconsideration later.
David Xia
davidxia.com
Well! It's not in the docs, but if you add "resourceUsageExportConfig": {"bigqueryDestination": {"datasetId": "some-dataset"}} at top level under the "cluster" block during the create call, then it does seem to work. :)
@ndmckinley Thanks. I'm having trouble getting that to work though. Could you give an example?
Ah, I didn't write that clearly! That's a note for the eventual implementation, it won't be doable right now in config.
It would be good to get this prioritized. This is a knob we want to turn on as we create gke clusters using terraform.
hey @ndmckinley / @rileykarson have a PR for this in https://github.com/GoogleCloudPlatform/magic-modules/pull/1742 - any chance you guys can take a look?
the workaround for us right now to have this enabled as part of our gke cluster module(s) is to use a local-exec provisioner to run the gcloud command to update the cluster once created but it is painfully slow (avg 18min to update) compare to when you create the cluster with this already enabled
Thanks @manuelfelipe! It looks like nobody got to it last week, but I'll prod someone to review it if it's left untouched for a couple more days.
Assigning to @hashibot to mark that @manuelfelipe is working on this.
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 👉 [email protected]. Thanks!
Most helpful comment
It would be good to get this prioritized. This is a knob we want to turn on as we create gke clusters using terraform.