@@ -134,6 +134,125 @@ resource "google_sql_database_instance" "instance" {
134134` , context )
135135}
136136
137+ func TestAccCloudRunService_cloudRunServiceConfigurationExample (t * testing.T ) {
138+ t .Parallel ()
139+
140+ context := map [string ]interface {}{
141+ "random_suffix" : randString (t , 10 ),
142+ }
143+
144+ vcrTest (t , resource.TestCase {
145+ PreCheck : func () { testAccPreCheck (t ) },
146+ Providers : testAccProvidersOiCS ,
147+ CheckDestroy : testAccCheckCloudRunServiceDestroyProducer (t ),
148+ Steps : []resource.TestStep {
149+ {
150+ Config : testAccCloudRunService_cloudRunServiceConfigurationExample (context ),
151+ },
152+ {
153+ ResourceName : "google_cloud_run_service.default" ,
154+ ImportState : true ,
155+ ImportStateVerify : true ,
156+ ImportStateVerifyIgnore : []string {"name" , "location" },
157+ },
158+ },
159+ })
160+ }
161+
162+ func testAccCloudRunService_cloudRunServiceConfigurationExample (context map [string ]interface {}) string {
163+ return Nprintf (`
164+ # Example configuration of a Cloud Run service
165+
166+ resource "google_cloud_run_service" "default" {
167+ name = "config%{random_suffix}"
168+ location = "us-central1"
169+
170+ template {
171+ spec {
172+ containers {
173+ image = "us-docker.pkg.dev/cloudrun/container/hello"
174+
175+ # Container "entry-point" command
176+ # https://cloud.google.com/run/docs/configuring/containers#configure-entrypoint
177+ command = ["/server"]
178+
179+ # Container "entry-point" args
180+ # https://cloud.google.com/run/docs/configuring/containers#configure-entrypoint
181+ args = []
182+
183+ # Enable HTTP/2
184+ # https://cloud.google.com/run/docs/configuring/http2
185+ ports {
186+ name = "h2c"
187+ container_port = 8080
188+ }
189+
190+ # Environment variables
191+ # https://cloud.google.com/run/docs/configuring/environment-variables
192+ env {
193+ name = "foo"
194+ value = "bar"
195+ }
196+ env {
197+ name = "baz"
198+ value = "quux"
199+ }
200+
201+ resources {
202+ limits = {
203+ # CPU usage limit
204+ # https://cloud.google.com/run/docs/configuring/cpu
205+ cpu = "1000m" # 1 vCPU
206+
207+ # Memory usage limit (per container)
208+ # https://cloud.google.com/run/docs/configuring/memory-limits
209+ memory = "512Mi"
210+ }
211+ }
212+ }
213+
214+ # Timeout
215+ # https://cloud.google.com/run/docs/configuring/request-timeout
216+ timeout_seconds = 300
217+
218+ # Maximum concurrent requests
219+ # https://cloud.google.com/run/docs/configuring/concurrency
220+ container_concurrency = 80
221+ }
222+
223+ metadata {
224+ annotations = {
225+
226+ # Max instances
227+ # https://cloud.google.com/run/docs/configuring/max-instances
228+ "autoscaling.knative.dev/maxScale" = 10
229+
230+ # Min instances
231+ # https://cloud.google.com/run/docs/configuring/min-instances
232+ "autoscaling.knative.dev/minScale" = 1
233+
234+ # If true, garbage-collect CPU when once a request finishes
235+ # https://cloud.google.com/run/docs/configuring/cpu-allocation
236+ "run.googleapis.com/cpu-throttling" = false
237+ }
238+
239+ # Labels
240+ # https://cloud.google.com/run/docs/configuring/labels
241+ labels = {
242+ foo : "bar"
243+ baz : "quux"
244+ }
245+ }
246+ }
247+
248+ traffic {
249+ percent = 100
250+ latest_revision = true
251+ }
252+ }
253+ ` , context )
254+ }
255+
137256func TestAccCloudRunService_cloudRunServiceNoauthExample (t * testing.T ) {
138257 t .Parallel ()
139258
0 commit comments