Skip to content
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

google_cloud_run_v2_service: BETA annotations lost and launch_stage re-set to GA #13748

Open
czka opened this issue Feb 15, 2023 · 2 comments
Open

Comments

@czka
Copy link

czka commented Feb 15, 2023

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to the modular-magician user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to hashibot, a community member has claimed the issue already.

Terraform Version

Terraform v1.3.8
on darwin_arm64
+ provider registry.terraform.io/hashicorp/google v4.53.1

Affected Resource(s)

  • google_cloud_run_v2_service

Terraform Configuration Files

resource "google_cloud_run_v2_service" "some_cloud_run" {
  name         = "some_cloud_run"
  location     = "<any region you like>"
  ingress      = "INGRESS_TRAFFIC_ALL"
  launch_stage = "BETA"

  template {
    revision = "one"

    annotations = {
      "run.googleapis.com/startup-cpu-boost" = true
      "run.googleapis.com/sessionAffinity"   = true
    }

    containers {
      image = "<any image you like>"
    }

    execution_environment = "EXECUTION_ENVIRONMENT_GEN2"
  }

  traffic {
    type    = "TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST"
    percent = 100
  }
}

Expected Behavior

launch_stage = "BETA" should not be ignored.

Actual Behavior

launch_stage = "BETA" is ignored and BETA annotations are lost when a new revision is deployed.

Steps to Reproduce

  1. Run terraform apply.
  2. Run terraform plan.
  3. Terraform reports a permadiff:
  # google_cloud_run_v2_service.some_cloud_run will be updated in-place
  ~ resource "google_cloud_run_v2_service" "some_cloud_run" {
        id                      = "<some project>"
        name                    = "some_cloud_run"
        # (17 unchanged attributes hidden)

      ~ template {
          ~ annotations                      = {
              + "run.googleapis.com/sessionAffinity"   = "true"
              + "run.googleapis.com/startup-cpu-boost" = "true"
            }
            # (6 unchanged attributes hidden)

            # (3 unchanged blocks hidden)
        }

        # (1 unchanged block hidden)
    }
  1. Trying to work around the permadiff you add the following to your google_cloud_run_v2_service.some_cloud_run definition:
  lifecycle {
    ignore_changes = [
      template.0.annotations["run.googleapis.com/sessionAffinity"],
      template.0.annotations["run.googleapis.com/startup-cpu-boost"],
    ]
  }
  1. You verify that terraform plan now returns No changes. Your infrastructure matches the configuration.. Seems legit.
  2. Soon you change the revision to e.g. two, to deploy a new image version.
  3. Run terraform apply:
  ~ resource "google_cloud_run_v2_service" "some_cloud_run" {
        id                      = "<some project>"
        name                    = "some_cloud_run"
        # (17 unchanged attributes hidden)

      ~ template {
          ~ revision                         = "one" -> "two"
            # (6 unchanged attributes hidden)

            # (3 unchanged blocks hidden)
        }

        # (1 unchanged block hidden)
    }
  1. It applies, new revision seems to be deployed OK. However, actually your BETA annotations are lost and the launch_stage is re-set to GA. As terraform plan confirms:
  ~ update in-place

Terraform will perform the following actions:

  ~ resource "google_cloud_run_v2_service" "some_cloud_run" {
        id                      = "<some project>"
      ~ launch_stage            = "GA" -> "BETA"
        name                    = "some_cloud_run"
        # (16 unchanged attributes hidden)

        # (2 unchanged blocks hidden)
    }
  1. The above is a permadiff, too.
@czka czka added the bug label Feb 15, 2023
@edwardmedia edwardmedia self-assigned this Feb 15, 2023
@czka czka changed the title BETA annotations lost and launch_stage re-set to GA google_cloud_run_v2_service: BETA annotations lost and launch_stage re-set to GA Feb 17, 2023
@edwardmedia
Copy link
Contributor

API decides what it returns. BETA in the request and GA is sent back.

b/269878160

@nfgrep
Copy link

nfgrep commented Apr 23, 2024

API decides what it returns. BETA in the request and GA is sent back.

Why? Is it the case that more than just the launch_stage annotation needs to be set for it to stick? e.g. does some other beta feature config need to be enabled aswell?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants