Skip to content

Commit df84ede

Browse files
feat: promote service scaling to GA in cloudrunv2 Service resource (#11794) (#8258)
[upstream:bc59ff8e5de2a4de939bf55188844c331f9d6939] Signed-off-by: Modular Magician <[email protected]>
1 parent e806c31 commit df84ede

File tree

3 files changed

+72
-3
lines changed

3 files changed

+72
-3
lines changed

.changelog/11794.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
cloudrunv2: promoted service-level `scaling` field in the `google_cloud_run_v2_service` resource to GA
3+
```

google-beta/services/cloudrunv2/resource_cloud_run_v2_service_test.go

+68-2
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,7 @@ func TestAccCloudRunV2Service_cloudrunv2ServiceWithServiceMinInstances(t *testin
982982
CheckDestroy: testAccCheckCloudRunV2ServiceDestroyProducer(t),
983983
Steps: []resource.TestStep{
984984
{
985-
Config: testAccCloudRunV2Service_cloudrunv2ServiceWithMinInstancesAndDefaultUriDisabled(context),
985+
Config: testAccCloudRunV2Service_cloudrunv2ServiceWithMinInstances(context),
986986
},
987987
{
988988
ResourceName: "google_cloud_run_v2_service.default",
@@ -1010,7 +1010,6 @@ resource "google_cloud_run_v2_service" "default" {
10101010
description = "description creating"
10111011
location = "us-central1"
10121012
deletion_protection = false
1013-
launch_stage = "BETA"
10141013
annotations = {
10151014
generated-by = "magic-modules"
10161015
}
@@ -1035,6 +1034,73 @@ resource "google_cloud_run_v2_service" "default" {
10351034
10361035
`, context)
10371036
}
1037+
func testAccCloudRunV2Service_cloudrunv2ServiceWithMinInstances(context map[string]interface{}) string {
1038+
return acctest.Nprintf(`
1039+
resource "google_cloud_run_v2_service" "default" {
1040+
name = "tf-test-cloudrun-service%{random_suffix}"
1041+
description = "description creating"
1042+
location = "us-central1"
1043+
deletion_protection = false
1044+
annotations = {
1045+
generated-by = "magic-modules"
1046+
}
1047+
ingress = "INGRESS_TRAFFIC_ALL"
1048+
labels = {
1049+
label-1 = "value-1"
1050+
}
1051+
client = "client-1"
1052+
client_version = "client-version-1"
1053+
scaling {
1054+
min_instance_count = 1
1055+
}
1056+
template {
1057+
containers {
1058+
name = "container-1"
1059+
image = "us-docker.pkg.dev/cloudrun/container/hello"
1060+
}
1061+
}
1062+
lifecycle {
1063+
ignore_changes = [
1064+
launch_stage,
1065+
]
1066+
}
1067+
}
1068+
1069+
`, context)
1070+
}
1071+
1072+
func TestAccCloudRunV2Service_cloudrunv2ServiceWithDefaultUriDisabled(t *testing.T) {
1073+
t.Parallel()
1074+
context := map[string]interface{}{
1075+
"random_suffix": acctest.RandString(t, 10),
1076+
}
1077+
acctest.VcrTest(t, resource.TestCase{
1078+
PreCheck: func() { acctest.AccTestPreCheck(t) },
1079+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
1080+
CheckDestroy: testAccCheckCloudRunV2ServiceDestroyProducer(t),
1081+
Steps: []resource.TestStep{
1082+
{
1083+
Config: testAccCloudRunV2Service_cloudrunv2ServiceWithMinInstancesAndDefaultUriDisabled(context),
1084+
},
1085+
{
1086+
ResourceName: "google_cloud_run_v2_service.default",
1087+
ImportState: true,
1088+
ImportStateVerify: true,
1089+
ImportStateVerifyIgnore: []string{"name", "location", "annotations", "labels", "terraform_labels", "launch_stage", "deletion_protection"},
1090+
},
1091+
{
1092+
Config: testAccCloudRunV2Service_cloudrunv2ServiceWithNoMinInstances(context),
1093+
},
1094+
{
1095+
ResourceName: "google_cloud_run_v2_service.default",
1096+
ImportState: true,
1097+
ImportStateVerify: true,
1098+
ImportStateVerifyIgnore: []string{"name", "location", "annotations", "labels", "terraform_labels", "launch_stage", "deletion_protection"},
1099+
},
1100+
},
1101+
})
1102+
}
1103+
10381104
func testAccCloudRunV2Service_cloudrunv2ServiceWithMinInstancesAndDefaultUriDisabled(context map[string]interface{}) string {
10391105
return acctest.Nprintf(`
10401106
resource "google_cloud_run_v2_service" "default" {

website/docs/r/cloud_run_v2_service.html.markdown

+1-1
Original file line numberDiff line numberDiff line change
@@ -1172,7 +1172,7 @@ The following arguments are supported:
11721172
For more information, see https://cloud.google.com/run/docs/configuring/custom-audiences.
11731173

11741174
* `scaling` -
1175-
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))
1175+
(Optional)
11761176
Scaling settings that apply to the whole service
11771177
Structure is [documented below](#nested_scaling).
11781178

0 commit comments

Comments
 (0)