hashicorp / terraform-provider-google

Terraform Provider for Google Cloud Platform
https://registry.terraform.io/providers/hashicorp/google/latest/docs
Mozilla Public License 2.0
2.36k stars 1.75k forks source link

`google_cloud_run_v2_service` - `containers` required, but not documented #20509

Open bchadwic opened 4 days ago

bchadwic commented 4 days ago

Community Note

Terraform Version & Provider Version(s)

Terraform v6.12.0

Affected Resource(s)

google_cloud_run_v2_service

Terraform Configuration

resource "google_cloud_run_v2_service" "default" {
  name     = "cloudrun-service2"
  project  = var.project
  location = "us-central1"
  template {
      service_account = var.service_account
  }
}

Debug Output

N/A

Expected Behavior

The documentation for cloud_run_v2_service states that the containers block is Optional.

I would expect that I would be able to deploy a cloud_run_v2_service without a containers block based on the documentation.

Actual Behavior

When deploying the code above, I get this error:

╷
│ Error: Error creating Service: googleapi: Error 400: Violation in CreateServiceRequest.service.template.containers: Revision template must contain at least one container.
│ Details:
│ [
│   {
│     "@type": "type.googleapis.com/google.rpc.BadRequest",
│     "fieldViolations": [
│       {
│         "description": "Revision template must contain at least one container.",
│         "field": "Violation in CreateServiceRequest.service.template.containers"
│       }
│     ]
│   }
│ ]
│ 
│   with google_cloud_run_v2_service.default,
│   on main.tf line 32, in resource "google_cloud_run_v2_service" "default":
│   32: resource "google_cloud_run_v2_service" "default" {
│ 
╵

Steps to reproduce

  1. terraform apply

Important Factoids

The documentation for the previous cloud_run_service resource states that containers are Required, so I'm assuming the mistake is within the cloud_run_v2_service documentation.

I understand that this may not be a bug with cloud_run_v2_service resource, but more so just a problem with the documentation. I can create a pr to update the documentation if this is the case.

References

No response

b/381438826

ggtisc commented 3 days ago

Confirmed documentation issue!

On terraform registry the argument containers of the template block code appears as Optional, but after running a terraform apply without setting any container it returns the shared error message