-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cloud Run env variables reordering causing resource to update in-place #7467
Comments
I don't see that happening for the sample config below name = "cloudrun-srv"
location = "us-central1"
template {
spec {
containers {
image = "gcr.io/cloudrun/hello"
env {
name = "SOURCE"
value = "remote"
}
env {
name = "TARGET"
value = "home"
}
}
}
}
traffic {
percent = 100
latest_revision = true
}
autogenerate_revision_name = true
} Can you please attach the plan output and debug log for your |
Hey! Thanks for your help, hopefully this is useful. I believe the issue is caused by the google_secret_manager_secret_version data object -- if the environment variables are hard-coded in plain text then we do not see the same behavior An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
# google_cloud_run_service.default will be updated in-place
~ resource "google_cloud_run_service" "default" {
id = "REDACTED"
location = "us-central1"
name = "terraform"
project = "REDACTED"
status = [
{
conditions = [
{
message = ""
reason = ""
status = "True"
type = "Ready"
},
{
message = ""
reason = ""
status = "True"
type = "ConfigurationsReady"
},
{
message = ""
reason = ""
status = "True"
type = "RoutesReady"
},
]
latest_created_revision_name = "terraform-bdff6"
latest_ready_revision_name = "terraform-bdff6"
observed_generation = 4
url = "REDACTED"
},
]
metadata {
annotations = {
"serving.knative.dev/creator" = "REDACTED"
"serving.knative.dev/lastModifier" = "REDACTED"
}
generation = 4
labels = {
"cloud.googleapis.com/location" = "us-central1"
}
namespace = "REDACTED"
resource_version = "AAWw4zi+fg0"
self_link = "REDACTED"
uid = "77fe171e-b695-427c-9eb0-833643c1523e"
}
~ template {
metadata {
annotations = {
"autoscaling.knative.dev/maxScale" = "1000"
"run.googleapis.com/vpc-access-connector" = "REDACTED"
}
generation = 0
labels = {}
}
~ spec {
container_concurrency = 20
service_account_name = "REDACTED"
~ containers {
args = []
command = []
image = "REDACTED"
~ env {
~ name = "ENV" -> "EXISTING_ENV"
~ value = "EXISTING_ENV_VALUE" -> "ENV_VALUE"
}
~ env {
~ name = "ENV" -> "EXISTING_ENV"
~ value = "EXISTING_ENV_VALUE" -> "ENV_VALUE"
}
~ env {
~ name = "ENV" -> "EXISTING_ENV"
~ value = "EXISTING_ENV_VALUE" -> "ENV_VALUE"
}
~ env {
~ name = "ENV" -> "EXISTING_ENV"
~ value = "EXISTING_ENV_VALUE" -> "ENV_VALUE"
}
~ env {
~ name = "ENV" -> "EXISTING_ENV"
~ value = "EXISTING_ENV_VALUE" -> "ENV_VALUE"
}
~ env {
~ name = "ENV" -> "EXISTING_ENV"
~ value = "EXISTING_ENV_VALUE" -> "ENV_VALUE"
}
resources {
limits = {
"cpu" = "1000m"
"memory" = "256Mi"
}
requests = {}
}
}
}
}
traffic {
latest_revision = true
percent = 100
}
} Debug Output 2020/10/08 17:12:42 [DEBUG] command: asking for input: "\nDo you want to perform these actions in workspace \"REDACTED"?" |
Please attach the debug output, I want to see API request/response. |
I assume that it is using the data source, isn't it? (https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/secret_manager_secret_version) If so, I could not verify this to be an issue, using:
@skreinberg97 is it still an issue for you? If so, can you provide more information, please? |
Hi @blueyed,
In my case, it is
|
Encountering the same thing. We also have some Secret versions being managed directly, not via a data source. For those I have generated an UUID as the name prefixed with In any case, even the non-secret environment variables are shuffled around. I wonder if we could just sort the environment variables a certain way to keep Terraform state happy and have the order be the same during all runs. |
It looks it is fixed by using https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/cloud_run_v2_service |
This also reproduces with |
I am also having this issue still |
Still having same issue using |
Same issue here with |
A temporary workaround is to delete all env variables in the UI and then |
facing same problem with google_cloud_run_v2_service |
The same is happening to me, but with secrets volumes |
I found this env change happend after import cloud_run_v2_service resourve,looks like import changed the env sort in terraform state ***.tfstate .
|
facing same problem with google_cloud_run_v2_service, was anyone able to figure out a solution? |
Same issue here |
Same here and also for regular variables - no secrets |
Throwing my voice into the void here, same issue, spot checking ENV VAR changes gets really hard when you have more than a handful of them. |
Same here. |
Same issue here on the latest version of the provider. We have about 20 services deployed and the output of It is worth noting that I'm using
|
Should this have been fixed by this change? It looks like it got included in v6.0.0 of the provider but the issue still persists for me. I'm adding the envs using dynamic blocks, if that makes a difference. |
Hello, I'm still having the problem. Adding env vars via dynamic block always create a lot of env vars shuffling when doing a |
Our cloud run resource needs to be updated every run as the environment variables are reordering. This seems to be completely on the Terraform side as our actual Cloud Run instance does not seem to be affected.
Terraform Version
v0.13.2
Affected Resource(s)
Terraform Configuration Files
Expected Behavior
For the environment variables to be in the same order, leading to no change in the resource.
Actual Behavior
Steps to Reproduce
terraform apply
and/orterraform plan
Important Factoids
References
b/272365080
The text was updated successfully, but these errors were encountered: