Skip to content

Commit

Permalink
feat: promote service scaling to GA in cloudrunv2 Service resource (G…
Browse files Browse the repository at this point in the history
  • Loading branch information
bskaplan authored Sep 23, 2024
1 parent 771215e commit bc59ff8
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 4 deletions.
1 change: 0 additions & 1 deletion mmv1/products/cloudrunv2/Service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,6 @@ properties:
item_type: Api::Type::String
- !ruby/object:Api::Type::NestedObject
name: 'scaling'
min_version: beta
description: |
Scaling settings that apply to the whole service
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,6 @@ resource "google_cloud_run_v2_service" "default" {
`, context)
}

<% unless version == 'ga' -%>
func TestAccCloudRunV2Service_cloudrunv2ServiceWithServiceMinInstances(t *testing.T) {
t.Parallel()
context := map[string]interface{} {
Expand All @@ -983,7 +982,7 @@ func TestAccCloudRunV2Service_cloudrunv2ServiceWithServiceMinInstances(t *testin
CheckDestroy: testAccCheckCloudRunV2ServiceDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccCloudRunV2Service_cloudrunv2ServiceWithMinInstancesAndDefaultUriDisabled(context),
Config: testAccCloudRunV2Service_cloudrunv2ServiceWithMinInstances(context),
},
{
ResourceName: "google_cloud_run_v2_service.default",
Expand Down Expand Up @@ -1012,7 +1011,6 @@ resource "google_cloud_run_v2_service" "default" {
description = "description creating"
location = "us-central1"
deletion_protection = false
launch_stage = "BETA"
annotations = {
generated-by = "magic-modules"
}
Expand All @@ -1037,6 +1035,77 @@ resource "google_cloud_run_v2_service" "default" {

`, context)
}
func testAccCloudRunV2Service_cloudrunv2ServiceWithMinInstances(context map[string]interface{}) string {
return acctest.Nprintf(`
resource "google_cloud_run_v2_service" "default" {
name = "tf-test-cloudrun-service%{random_suffix}"
description = "description creating"
location = "us-central1"
deletion_protection = false
annotations = {
generated-by = "magic-modules"
}
ingress = "INGRESS_TRAFFIC_ALL"
labels = {
label-1 = "value-1"
}
client = "client-1"
client_version = "client-version-1"
scaling {
min_instance_count = 1
}
template {
containers {
name = "container-1"
image = "us-docker.pkg.dev/cloudrun/container/hello"
}
}
lifecycle {
ignore_changes = [
launch_stage,
]
}
}

`, context)
}


<% unless version == 'ga' -%>

func TestAccCloudRunV2Service_cloudrunv2ServiceWithDefaultUriDisabled(t *testing.T) {
t.Parallel()
context := map[string]interface{} {
"random_suffix" : acctest.RandString(t, 10),
}
acctest.VcrTest(t, resource.TestCase {
PreCheck: func() { acctest.AccTestPreCheck(t)},
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
CheckDestroy: testAccCheckCloudRunV2ServiceDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccCloudRunV2Service_cloudrunv2ServiceWithMinInstancesAndDefaultUriDisabled(context),
},
{
ResourceName: "google_cloud_run_v2_service.default",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"name", "location", "annotations", "labels", "terraform_labels", "launch_stage", "deletion_protection"},
},
{
Config: testAccCloudRunV2Service_cloudrunv2ServiceWithNoMinInstances(context),
},
{
ResourceName: "google_cloud_run_v2_service.default",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"name", "location", "annotations", "labels", "terraform_labels", "launch_stage", "deletion_protection"},
},

},
})
}

func testAccCloudRunV2Service_cloudrunv2ServiceWithMinInstancesAndDefaultUriDisabled(context map[string]interface{}) string {
return acctest.Nprintf(`
resource "google_cloud_run_v2_service" "default" {
Expand Down Expand Up @@ -1073,6 +1142,7 @@ resource "google_cloud_run_v2_service" "default" {

`, context)
}

<% end -%>
<% unless version == 'ga' -%>
Expand Down

0 comments on commit bc59ff8

Please sign in to comment.