diff --git a/dashboard.tf b/dashboard.tf
index b639e7c637da63493c73454e6218775040cccde6..dcf1d6555da35588d3ed69b5199519ac13796af0 100644
--- a/dashboard.tf
+++ b/dashboard.tf
@@ -5,18 +5,15 @@
 # - Request latencies for 50th, 95th and 99th percentile.
 # - Container CPU and memory utilisations for 50th, 95th and 99th percentile.
 # - Container instance count and billable instance time.
-
-data "template_file" "dashboard_json" {
-  count = var.create_monitoring_dashboard ? 1 : 0
-
-  template = file("${path.module}/dashboard.json")
-  vars = {
+locals {
+  dashboard_template = templatefile("${path.module}/dashboard.json", {
     service_name = var.name
     region       = var.cloud_run_region
-  }
+  })
 }
 
 resource "google_monitoring_dashboard" "dashboard" {
-  for_each       = toset([for template in data.template_file.dashboard_json : template.rendered])
-  dashboard_json = each.key
+  count = var.create_monitoring_dashboard ? 1 : 0
+
+  dashboard_json = local.dashboard_template
 }