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

cloudrunv2: Validate number of ports specified restricting to 1. #17594

Conversation

modular-magician
Copy link
Collaborator

Accidentally specifying the containers.ports twice results in the following error:

Error: Error updating Service "projects/myproject/locations/us-central1/services/myservice": googleapi: Error 400: Violation in UpdateServiceRequest.service.template.containers[0].ports: ports should contain 0 or 1 port.
│ Details:
│ [
│   {
│     "@type": "type.googleapis.com/google.rpc.BadRequest",
│     "fieldViolations": [
│       {
│         "description": "ports should contain 0 or 1 port.",
│         "field": "Violation in UpdateServiceRequest.service.template.containers[0].ports"
│       }
│     ]
│   }
│ ]
│ 
│   with google_cloud_run_v2_service.myservice,
│   on myservice.tf line 1, in resource "google_cloud_run_v2_service" "myservice":
│    1: resource "google_cloud_run_v2_service" "myservice" {
│ 

It would be convenient if this issue could be caught at validation time.

cloudrunv2: added the validation to restrict number of ports to 1 to fail earlier than server-side validation

Derived from GoogleCloudPlatform/magic-modules#10173

…hicorp#10173)

* cloudrunv2: Validate number of ports specified restricting to 1.

* Update mmv1/products/cloudrunv2/Service.yaml

[upstream:219ab589aaafa919c7011967def03305f56c8462]

Signed-off-by: Modular Magician <magic-modules@google.com>
@modular-magician modular-magician merged commit 0e051af into hashicorp:main Mar 14, 2024
2 checks passed
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant