简体   繁体   English

如何使用 terraform 创建 CloudRun 将机密导出为 env var?

[英]How to create a CloudRun with terraform export a secret as env var?

I'm want to create a Cloud Run using terraform.我想使用 terraform 创建一个 Cloud Run。 The example is working from here: https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/cloud_run_service#example-usage---cloud-run-service-basic该示例从这里开始工作: https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/cloud_run_service#example-usage---cloud-run-service-basic

I have the following secret: /projects/my-project-id/secret/VAR, and would like to export this secret as VAR env var.我有以下秘密:/projects/my-project-id/secret/VAR,并希望将此秘密导出为 VAR env var。

How do I do that?我怎么做?

Just add this section inside of containers:只需在容器内添加此部分:

        env {
          name = "VAR"
          value_from {
            secret_key_ref {
              name = "VAR"
              key  = "1"
            }
          }
        }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 cloudrun 中公开 2 个端口 - How to expose 2 ports in cloudrun 如何在 terraform 中从 GCP 秘密管理器读取秘密 - How to read a secret from GCP secret manager in terraform 如何从 terraform 中的跨区域 AWS Secret Manager 检索机密 - How to retrieve secret from cross region AWS Secret Manager in terraform 如何在 terraform (0.11.13) 中将 aws secret manager 字符串转换为 map - How to convert the aws secret manager string to map in terraform (0.11.13) 如何在 DBT Model 中使用引号内的 env_var? - How to use env_var inside quotes in DBT Model? Terraform AWS Redshift 和 Secret Manager - Terraform AWS Redshift and Secret Manager 在 terraform 中创建 GCP 服务帐户并将服务帐户密钥存储在 Secret Manager 中 - Create GCP service account and store service account key in secret manager in terraform 如何在中转网关模块中创建附件 terraform - How to create attachments in transit gateway module terraform 如何使用 Terraform 创建私有 S3 存储桶? - How to create private S3 bucket with Terraform? Google Cloud Platform:秘密作为构建环境变量 - Google Cloud Platform: secret as build env variable
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM