Skip to content

Commit 896ec95

Browse files
ian-miYury Gridasov
authored and
Yury Gridasov
committed
Add Cloud Run v2 Service urls field (GoogleCloudPlatform#12194)
1 parent ac7614e commit 896ec95

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

mmv1/products/cloudrunv2/Service.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -1117,6 +1117,13 @@ properties:
11171117
description: |
11181118
The main URI in which this Service is serving traffic.
11191119
output: true
1120+
- name: 'urls'
1121+
type: Array
1122+
item_type:
1123+
type: String
1124+
description: |-
1125+
All URLs serving traffic for this Service.
1126+
output: true
11201127
- name: 'reconciling'
11211128
type: Boolean
11221129
description: |

mmv1/third_party/terraform/services/cloudrunv2/data_source_google_cloud_run_v2_service_test.go

+7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package cloudrunv2_test
22

33
import (
44
"fmt"
5+
"regexp"
56
"testing"
67

78
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
@@ -17,6 +18,10 @@ func TestAccDataSourceGoogleCloudRunV2Service_basic(t *testing.T) {
1718
name := fmt.Sprintf("tf-test-cloud-run-v2-service-%d", acctest.RandInt(t))
1819
location := "us-central1"
1920
id := fmt.Sprintf("projects/%s/locations/%s/services/%s", project, location, name)
21+
deterministicURLRegex, err := regexp.Compile(fmt.Sprintf("https://%s-[0-9]+.%s.run.ap", name, location))
22+
if err != nil {
23+
t.Fatalf("Failed to compile deterministic URL regex: %v", err)
24+
}
2025

2126
acctest.VcrTest(t, resource.TestCase{
2227
PreCheck: func() { acctest.AccTestPreCheck(t) },
@@ -28,6 +33,8 @@ func TestAccDataSourceGoogleCloudRunV2Service_basic(t *testing.T) {
2833
resource.TestCheckResourceAttr("data.google_cloud_run_v2_service.hello", "id", id),
2934
resource.TestCheckResourceAttr("data.google_cloud_run_v2_service.hello", "name", name),
3035
resource.TestCheckResourceAttr("data.google_cloud_run_v2_service.hello", "location", location),
36+
resource.TestCheckResourceAttr("data.google_cloud_run_v2_service.hello", "urls.#", "2"),
37+
resource.TestMatchResourceAttr("data.google_cloud_run_v2_service.hello", "urls.0", deterministicURLRegex),
3138
),
3239
},
3340
},

0 commit comments

Comments
 (0)