Can I set a revision tag for my google cloud run service via terraform?

640 Views Asked by At

I'd like to set a revision tag on the cloud run service revision created by applying my terraform plan.

I see nothing in the terraform cloud run service documentation that would allow me to set a revision tag. I tried the following, for the heck of it:

traffic {
  percent = 100
  tag     = my-tag
}

which results in an Unsupported Argument Error.

I've explored the alternative strategy of using gcloud commands to add the tag after the revision is created; however, any commands which successfully tag the latest revision also remove tags from any prior revisions (I suppose because I'm updating the service wholesale, rather that modifying a particular revision).

1

There are 1 best solutions below

0
On

I ran into a very similar issue. After hunting on the hashcorp github issues, I realized that the fix was just recently included, so you need to update your google provider.

Here a working configuration that has supported tag inside traffic module:

terraform {

    required_providers {
        google = {
          source  = "hashicorp/google"
          version = "~> 4.52.0"
        }
      }

    required_version = ">= 1.1.9"
}