Skip to content

Commit

Permalink
Add field default_uri_disabled to google_cloud_run_v2_job resource (
Browse files Browse the repository at this point in the history
  • Loading branch information
yanweiguo authored May 24, 2024
1 parent 285e759 commit bf9c43f
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 56 deletions.
5 changes: 5 additions & 0 deletions mmv1/products/cloudrunv2/Service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,11 @@ properties:
name: 'minInstanceCount'
description: |
Minimum number of instances for the service, to be divided among all revisions receiving traffic.
- !ruby/object:Api::Type::Boolean
name: 'defaultUriDisabled'
min_version: beta
description: |-
Disables public resolution of the default URI of this service.
- !ruby/object:Api::Type::NestedObject
name: 'template'
required: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,60 @@ func TestAccCloudRunV2Service_cloudrunv2ServiceAttributionLabel(t *testing.T) {
})
}

func testAccCloudRunV2Service_cloudrunv2ServiceWithAttributionLabel(context map[string]interface{}) string {
return acctest.Nprintf(`
provider "google" {
add_terraform_attribution_label = %{add_attribution}
terraform_attribution_label_addition_strategy = "%{attribution_strategy}"
}

resource "google_cloud_run_v2_service" "default" {
name = "tf-test-cloudrun-service%{random_suffix}"
location = "us-central1"

labels = {
user_label = "foo"
}

template {
containers {
image = "us-docker.pkg.dev/cloudrun/container/hello"
ports {
container_port = 8080
}
}
}
}
`, context)
}

func testAccCloudRunV2Service_cloudrunv2ServiceWithAttributionLabelUpdate(context map[string]interface{}) string {
return acctest.Nprintf(`
provider "google" {
add_terraform_attribution_label = %{add_attribution}
terraform_attribution_label_addition_strategy = "%{attribution_strategy}"
}

resource "google_cloud_run_v2_service" "default" {
name = "tf-test-cloudrun-service%{random_suffix}"
location = "us-central1"

labels = {
user_label = "bar"
}

template {
containers {
image = "us-docker.pkg.dev/cloudrun/container/hello"
ports {
container_port = 8080
}
}
}
}
`, context)
}

<% unless version == 'ga' -%>
func TestAccCloudRunV2Service_cloudrunv2ServiceWithServiceMinInstances(t *testing.T) {
t.Parallel()
Expand All @@ -907,7 +961,7 @@ func TestAccCloudRunV2Service_cloudrunv2ServiceWithServiceMinInstances(t *testin
CheckDestroy: testAccCheckCloudRunV2ServiceDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccCloudRunV2Service_cloudrunv2ServiceWithMinInstances(context),
Config: testAccCloudRunV2Service_cloudrunv2ServiceWithMinInstancesAndDefaultUriDisabled(context),
},
{
ResourceName: "google_cloud_run_v2_service.default",
Expand Down Expand Up @@ -960,7 +1014,7 @@ resource "google_cloud_run_v2_service" "default" {

`, context)
}
func testAccCloudRunV2Service_cloudrunv2ServiceWithMinInstances(context map[string]interface{}) string {
func testAccCloudRunV2Service_cloudrunv2ServiceWithMinInstancesAndDefaultUriDisabled(context map[string]interface{}) string {
return acctest.Nprintf(`
resource "google_cloud_run_v2_service" "default" {
name = "tf-test-cloudrun-service%{random_suffix}"
Expand All @@ -979,6 +1033,7 @@ resource "google_cloud_run_v2_service" "default" {
scaling {
min_instance_count = 1
}
default_uri_disabled = true
template {
containers {
name = "container-1"
Expand All @@ -995,57 +1050,3 @@ resource "google_cloud_run_v2_service" "default" {
`, context)
}
<% end -%>

func testAccCloudRunV2Service_cloudrunv2ServiceWithAttributionLabel(context map[string]interface{}) string {
return acctest.Nprintf(`
provider "google" {
add_terraform_attribution_label = %{add_attribution}
terraform_attribution_label_addition_strategy = "%{attribution_strategy}"
}

resource "google_cloud_run_v2_service" "default" {
name = "tf-test-cloudrun-service%{random_suffix}"
location = "us-central1"

labels = {
user_label = "foo"
}

template {
containers {
image = "us-docker.pkg.dev/cloudrun/container/hello"
ports {
container_port = 8080
}
}
}
}
`, context)
}

func testAccCloudRunV2Service_cloudrunv2ServiceWithAttributionLabelUpdate(context map[string]interface{}) string {
return acctest.Nprintf(`
provider "google" {
add_terraform_attribution_label = %{add_attribution}
terraform_attribution_label_addition_strategy = "%{attribution_strategy}"
}

resource "google_cloud_run_v2_service" "default" {
name = "tf-test-cloudrun-service%{random_suffix}"
location = "us-central1"

labels = {
user_label = "bar"
}

template {
containers {
image = "us-docker.pkg.dev/cloudrun/container/hello"
ports {
container_port = 8080
}
}
}
}
`, context)
}

0 comments on commit bf9c43f

Please sign in to comment.