Skip to content

Commit

Permalink
Move Cloud Run VPC Connector annotations to template metadata (#735) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sethmoon authored Jul 13, 2022
1 parent ef27d2e commit a8677ed
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions modules/cloud-run/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ locals {
annotations = merge(
var.ingress_settings == null ? {} : {
"run.googleapis.com/ingress" = var.ingress_settings
},
}
)
template_annotations = merge(
var.vpc_connector == null ? {} : {
"run.googleapis.com/vpc-access-connector" = (
try(var.vpc_connector.create, false)
Expand All @@ -30,7 +32,8 @@ locals {
"run.googleapis.com/vpc-access-egress" = var.vpc_connector.egress_settings
}
)
prefix = var.prefix == null ? "" : "${var.prefix}-"
revision_name = try(var.revision_name, null) == null ? null : "${var.name}-${var.revision_name}"
prefix = var.prefix == null ? "" : "${var.prefix}-"
service_account_email = (
var.service_account_create
? (
Expand Down Expand Up @@ -151,11 +154,9 @@ resource "google_cloud_run_service" "service" {
}
}
}
dynamic "metadata" {
for_each = var.revision_name == null ? [] : [""]
content {
name = "${var.name}-${var.revision_name}"
}
metadata {
name = local.revision_name
annotations = local.template_annotations
}
}

Expand Down

0 comments on commit a8677ed

Please sign in to comment.