0

I am trying to deploy an application in Google Cloud Run with Terraform and there are some secrets I want to reference in the Cloud Run Service. However I am getting this error:

Error: Unsupported block type
│ 
│   on main.tf line 122, in resource "google_cloud_run_service" "default":
│   122:           value_from {
│ 
│ Blocks of type "value_from" are not expected here.

But in the documentation it shows that I can use value_from to reference a secret. Is there anyone who knows what is the problem?

Note: My hashicorp/google provider version is 3.90.1

Aiden Pearce
  • 243
  • 2
  • 13

1 Answers1

2

It was in beta for that provider version:

value_from - (Optional, Beta) Source for the environment variable's value. Only supports secret_key_ref. Structure is documented below.

So you would either have to use google-beta provider [1] or switch to a newer provider version where it is no longer in beta. For example, in the latest provider version [2]:

value_from - (Optional) Source for the environment variable's value. Only supports secret_key_ref. Structure is documented below.


[1] https://registry.terraform.io/providers/hashicorp/google/3.90.1/docs/guides/provider_versions#using-the-google-beta-provider

[2] https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/cloud_run_service

Marko E
  • 13,362
  • 2
  • 19
  • 28