- 
                Notifications
    
You must be signed in to change notification settings  - Fork 133
 
Open
Description
Hello,
I am trying to setup a multiple container cloud run, but I am getting this error :
Error creating Service: googleapi: Error 400: template.containers: Revision template should contain exactly one container with an exposed port.
My setup :
module "multi" {
  source  = "GoogleCloudPlatform/cloud-run/google//modules/v2"
  version = "0.16.3"
  project_id      = "XXXX"
  service_name    = "hello-world"
  location        = "europe-west9"
  containers      = [
    {
      container_image = "nginx:latest"
      container_name  = "nginx"
      ports = {
        name           = "http1"
        container_port = "80"
      }
    },
    {
      container_image = "us-docker.pkg.dev/cloudrun/container/hello"
      container_name  = "hello"
    },
  ]
}
So maybe I am missing someting, of this local is not working as expected :
  ingress_container = try(
    [for container in var.containers : container if length(try(container.ports, {})) > 0][0],
    null
  )
This one should work :
containers_with_ports = [for c in var.containers : c if lookup(c, "port", null) != null]
Thx
krissrex, olivier-lacroix and jeunii
Metadata
Metadata
Assignees
Labels
No labels