Skip to content

Commit ac9adbe

Browse files
authored
Add support for google_cloud_run_v2_service to TGC (#15132)
1 parent 3e114d4 commit ac9adbe

File tree

3 files changed

+107
-0
lines changed

3 files changed

+107
-0
lines changed

mmv1/third_party/tgc/resource_converters.go.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ func ResourceConverters() map[string][]cai.ResourceConverter {
146146
"google_access_context_manager_service_perimeter": {accesscontextmanager.ResourceConverterAccessContextManagerServicePerimeter()},
147147
"google_access_context_manager_access_policy": {accesscontextmanager.ResourceConverterAccessContextManagerAccessPolicy()},
148148
"google_cloud_run_service": {cloudrun.ResourceConverterCloudRunService()},
149+
"google_cloud_run_v2_service": {cloudrunv2.ResourceConverterCloudRunV2Service()},
149150
"google_cloud_run_domain_mapping": {cloudrun.ResourceConverterCloudRunDomainMapping()},
150151
"google_cloud_run_v2_job": {cloudrunv2.ResourceConverterCloudRunV2Job()},
151152
"google_cloudfunctions_function": {cloudfunctions.ResourceConverterCloudFunctionsCloudFunction()},
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
[
2+
{
3+
"name": "//run.googleapis.com/projects/{{.Provider.project}}/locations/us-central1/services/cloudrunv2-to-get-cai",
4+
"asset_type": "run.googleapis.com/Service",
5+
"ancestry_path": "{{.Ancestry}}/project/{{.Provider.project}}",
6+
"resource": {
7+
"version": "v2",
8+
"discovery_document_uri": "https://www.googleapis.com/discovery/v1/apis/run/v2/rest",
9+
"discovery_name": "Service",
10+
"parent": "//cloudresourcemanager.googleapis.com/projects/{{.Provider.project}}",
11+
"data": {
12+
"annotations": {
13+
"generated-by": "magic-modules"
14+
},
15+
"labels": {
16+
"goog-terraform-provisioned": "true"
17+
},
18+
"template": {
19+
"containers": [
20+
{
21+
"args": [
22+
"arrgs"
23+
],
24+
"image": "gcr.io/cloudrun/hello",
25+
"ports": [
26+
{
27+
"containerPort": 8080
28+
}
29+
]
30+
}
31+
],
32+
"maxInstanceRequestConcurrency": 10,
33+
"timeout": "600s"
34+
},
35+
"traffic": [
36+
{
37+
"percent": 100,
38+
"type": "TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST"
39+
}
40+
]
41+
}
42+
}
43+
}
44+
]
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/**
2+
* Copyright 2021 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
terraform {
18+
required_providers {
19+
google = {
20+
source = "hashicorp/google-beta"
21+
version = "~> {{.Provider.version}}"
22+
}
23+
}
24+
}
25+
26+
provider "google" {
27+
{{if .Provider.credentials }}credentials = "{{.Provider.credentials}}"{{end}}
28+
}
29+
30+
resource "google_cloud_run_v2_service" "default" {
31+
name = "cloudrunv2-to-get-cai"
32+
location = "us-central1"
33+
project = "{{.Provider.project}}"
34+
35+
annotations = {
36+
"generated-by" = "magic-modules"
37+
}
38+
39+
template {
40+
max_instance_request_concurrency = 10
41+
timeout = "600s"
42+
43+
containers {
44+
image = "gcr.io/cloudrun/hello"
45+
args = ["arrgs"]
46+
ports {
47+
container_port = 8080
48+
}
49+
}
50+
}
51+
52+
traffic {
53+
percent = 100
54+
type = "TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST"
55+
}
56+
57+
lifecycle {
58+
ignore_changes = [
59+
annotations,
60+
]
61+
}
62+
}

0 commit comments

Comments
 (0)