gha*_*nek 2 google-cloud-platform terraform google-cloud-run
我是 Terraform 新手,但我做了很多研究但找不到答案。我使用简单的 Terraform 文件创建 Cloud Run 实例没有问题。我可以毫无问题地设置环境变量和秘密。但是,我不知道如何创建其他设置,例如“内存分配”、“CPU 分配”等。
我的 terraform 文件如下所示:
resource "google_cloud_run_service" "myproject" {
project ="myproject"
name = "cloud-run-name"
location = "us-east1"
template {
spec {
containers {
image = "gcr.io/myproject/image"
env {
name = "VARIABLE1"
value = "variable1"
}
env {
name = "VARIABLE2"
value = "variable1"
}
}
}
}
traffic {
percent = 100
latest_revision = true
}
}
Run Code Online (Sandbox Code Playgroud)
内存/CPU 位于模板 > 规格 > 容器 > 资源下。模板 > 规范下的超时和并发。
这是一个例子:
template {
spec {
container_concurrency = var.concurrency
timeout_seconds = var.timeout
containers {
image = "gcr.io/myproject/image"
ports {
container_port = var.port
}
resources {
limits = {
cpu = "2m"
memory = "8000Mi"
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3015 次 |
最近记录: |