forked from hashicorp/terraform-provider-google-beta
/
resource_cloud_run_v2_service.go
4109 lines (3660 loc) · 166 KB
/
resource_cloud_run_v2_service.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
// ----------------------------------------------------------------------------
//
// *** AUTO GENERATED CODE *** Type: MMv1 ***
//
// ----------------------------------------------------------------------------
//
// This file is automatically generated by Magic Modules and manual
// changes will be clobbered when the file is regenerated.
//
// Please read more about how to change this file in
// .github/CONTRIBUTING.md.
//
// ----------------------------------------------------------------------------
package cloudrunv2
import (
"fmt"
"log"
"reflect"
"time"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/lorioux/google-beta/google-beta/tpgresource"
transport_tpg "github.com/lorioux/google-beta/google-beta/transport"
"github.com/lorioux/google-beta/google-beta/verify"
)
func ResourceCloudRunV2Service() *schema.Resource {
return &schema.Resource{
Create: resourceCloudRunV2ServiceCreate,
Read: resourceCloudRunV2ServiceRead,
Update: resourceCloudRunV2ServiceUpdate,
Delete: resourceCloudRunV2ServiceDelete,
Importer: &schema.ResourceImporter{
State: resourceCloudRunV2ServiceImport,
},
Timeouts: &schema.ResourceTimeout{
Create: schema.DefaultTimeout(20 * time.Minute),
Update: schema.DefaultTimeout(20 * time.Minute),
Delete: schema.DefaultTimeout(20 * time.Minute),
},
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
DiffSuppressFunc: tpgresource.CompareSelfLinkOrResourceName,
Description: `Name of the Service.`,
},
"template": {
Type: schema.TypeList,
Required: true,
Description: `The template used to create revisions for this Service.`,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"annotations": {
Type: schema.TypeMap,
Optional: true,
Description: `Unstructured key value map that may be set by external tools to store and arbitrary metadata. They are not queryable and should be preserved when modifying objects.
Cloud Run API v2 does not support annotations with 'run.googleapis.com', 'cloud.googleapis.com', 'serving.knative.dev', or 'autoscaling.knative.dev' namespaces, and they will be rejected.
All system annotations in v1 now have a corresponding field in v2 RevisionTemplate.
This field follows Kubernetes annotations' namespacing, limits, and rules.`,
Elem: &schema.Schema{Type: schema.TypeString},
},
"containers": {
Type: schema.TypeList,
Optional: true,
Description: `Holds the containers that define the unit of execution for this Service.`,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"image": {
Type: schema.TypeString,
Required: true,
Description: `URL of the Container image in Google Container Registry or Google Artifact Registry. More info: https://kubernetes.io/docs/concepts/containers/images`,
},
"args": {
Type: schema.TypeList,
Optional: true,
Description: `Arguments to the entrypoint. The docker image's CMD is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell`,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"command": {
Type: schema.TypeList,
Optional: true,
Description: `Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell`,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"depends_on": {
Type: schema.TypeList,
Optional: true,
Description: `Containers which should be started before this container. If specified the container will wait to start until all containers with the listed names are healthy.`,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"env": {
Type: schema.TypeList,
Optional: true,
Description: `List of environment variables to set in the container.`,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
Description: `Name of the environment variable. Must be a C_IDENTIFIER, and mnay not exceed 32768 characters.`,
},
"value": {
Type: schema.TypeString,
Optional: true,
Description: `Variable references $(VAR_NAME) are expanded using the previous defined environment variables in the container and any route environment variables. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Defaults to "", and the maximum length is 32768 bytes`,
},
"value_source": {
Type: schema.TypeList,
Optional: true,
Description: `Source for the environment variable's value.`,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"secret_key_ref": {
Type: schema.TypeList,
Optional: true,
Description: `Selects a secret and a specific version from Cloud Secret Manager.`,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"secret": {
Type: schema.TypeString,
Required: true,
Description: `The name of the secret in Cloud Secret Manager. Format: {secretName} if the secret is in the same project. projects/{project}/secrets/{secretName} if the secret is in a different project.`,
},
"version": {
Type: schema.TypeString,
Optional: true,
Description: `The Cloud Secret Manager secret version. Can be 'latest' for the latest value or an integer for a specific version.`,
},
},
},
},
},
},
},
},
},
},
"liveness_probe": {
Type: schema.TypeList,
Computed: true,
Optional: true,
Description: `Periodic probe of container liveness. Container will be restarted if the probe fails. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes`,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"failure_threshold": {
Type: schema.TypeInt,
Optional: true,
Description: `Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value is 1.`,
Default: 3,
},
"grpc": {
Type: schema.TypeList,
Optional: true,
Description: `GRPC specifies an action involving a GRPC port.`,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"port": {
Type: schema.TypeInt,
Computed: true,
Optional: true,
Description: `Port number to access on the container. Number must be in the range 1 to 65535.
If not specified, defaults to the same value as container.ports[0].containerPort.`,
},
"service": {
Type: schema.TypeString,
Optional: true,
Description: `The name of the service to place in the gRPC HealthCheckRequest
(see https://github.com/grpc/grpc/blob/master/doc/health-checking.md).
If this is not specified, the default behavior is defined by gRPC.`,
},
},
},
},
"http_get": {
Type: schema.TypeList,
Optional: true,
Description: `HTTPGet specifies the http request to perform.`,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"http_headers": {
Type: schema.TypeList,
Optional: true,
Description: `Custom headers to set in the request. HTTP allows repeated headers.`,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
Description: `The header field name`,
},
"value": {
Type: schema.TypeString,
Optional: true,
Description: `The header field value`,
Default: "",
},
},
},
},
"path": {
Type: schema.TypeString,
Optional: true,
Description: `Path to access on the HTTP server. Defaults to '/'.`,
Default: "/",
},
"port": {
Type: schema.TypeInt,
Computed: true,
Optional: true,
Description: `Port number to access on the container. Number must be in the range 1 to 65535.
If not specified, defaults to the same value as container.ports[0].containerPort.`,
},
},
},
},
"initial_delay_seconds": {
Type: schema.TypeInt,
Optional: true,
Description: `Number of seconds after the container has started before the probe is initiated. Defaults to 0 seconds. Minimum value is 0. Maximum value for liveness probe is 3600. Maximum value for startup probe is 240. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes`,
Default: 0,
},
"period_seconds": {
Type: schema.TypeInt,
Optional: true,
Description: `How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1. Maximum value for liveness probe is 3600. Maximum value for startup probe is 240. Must be greater or equal than timeoutSeconds`,
Default: 10,
},
"tcp_socket": {
Type: schema.TypeList,
Optional: true,
Deprecated: "`tcp_socket` is deprecated and will be removed in a future major release. This field is not supported by the Cloud Run API.",
Description: `TCPSocket specifies an action involving a TCP port. This field is not supported in liveness probe currently.`,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"port": {
Type: schema.TypeInt,
Optional: true,
Description: `Port number to access on the container. Must be in the range 1 to 65535. If not specified, defaults to 8080.`,
},
},
},
},
"timeout_seconds": {
Type: schema.TypeInt,
Optional: true,
Description: `Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1. Maximum value is 3600. Must be smaller than periodSeconds. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes`,
Default: 1,
},
},
},
},
"name": {
Type: schema.TypeString,
Optional: true,
Description: `Name of the container specified as a DNS_LABEL.`,
},
"ports": {
Type: schema.TypeList,
Computed: true,
Optional: true,
Description: `List of ports to expose from the container. Only a single port can be specified. The specified ports must be listening on all interfaces (0.0.0.0) within the container to be accessible.
If omitted, a port number will be chosen and passed to the container through the PORT environment variable for the container to listen on`,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"container_port": {
Type: schema.TypeInt,
Optional: true,
Description: `Port number the container listens on. This must be a valid TCP port number, 0 < containerPort < 65536.`,
},
"name": {
Type: schema.TypeString,
Computed: true,
Optional: true,
Description: `If specified, used to specify which protocol to use. Allowed values are "http1" and "h2c".`,
},
},
},
},
"resources": {
Type: schema.TypeList,
Computed: true,
Optional: true,
Description: `Compute Resource requirements by this container. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources`,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"cpu_idle": {
Type: schema.TypeBool,
Optional: true,
Description: `Determines whether CPU should be throttled or not outside of requests.`,
},
"limits": {
Type: schema.TypeMap,
Computed: true,
Optional: true,
Description: `Only memory and CPU are supported. Note: The only supported values for CPU are '1', '2', '4', and '8'. Setting 4 CPU requires at least 2Gi of memory. The values of the map is string form of the 'quantity' k8s type: https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/api/resource/quantity.go`,
Elem: &schema.Schema{Type: schema.TypeString},
},
"startup_cpu_boost": {
Type: schema.TypeBool,
Optional: true,
Description: `Determines whether CPU should be boosted on startup of a new container instance above the requested CPU threshold, this can help reduce cold-start latency.`,
},
},
},
},
"startup_probe": {
Type: schema.TypeList,
Computed: true,
Optional: true,
Description: `Startup probe of application within the container. All other probes are disabled if a startup probe is provided, until it succeeds. Container will not be added to service endpoints if the probe fails. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes`,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"failure_threshold": {
Type: schema.TypeInt,
Optional: true,
Description: `Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3. Minimum value is 1.`,
Default: 3,
},
"grpc": {
Type: schema.TypeList,
Optional: true,
Description: `GRPC specifies an action involving a GRPC port.`,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"port": {
Type: schema.TypeInt,
Computed: true,
Optional: true,
Description: `Port number to access on the container. Number must be in the range 1 to 65535.
If not specified, defaults to the same value as container.ports[0].containerPort.`,
},
"service": {
Type: schema.TypeString,
Optional: true,
Description: `The name of the service to place in the gRPC HealthCheckRequest
(see https://github.com/grpc/grpc/blob/master/doc/health-checking.md).
If this is not specified, the default behavior is defined by gRPC.`,
},
},
},
},
"http_get": {
Type: schema.TypeList,
Optional: true,
Description: `HTTPGet specifies the http request to perform. Exactly one of HTTPGet or TCPSocket must be specified.`,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"http_headers": {
Type: schema.TypeList,
Optional: true,
Description: `Custom headers to set in the request. HTTP allows repeated headers.`,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
Description: `The header field name`,
},
"value": {
Type: schema.TypeString,
Optional: true,
Description: `The header field value`,
Default: "",
},
},
},
},
"path": {
Type: schema.TypeString,
Optional: true,
Description: `Path to access on the HTTP server. Defaults to '/'.`,
Default: "/",
},
"port": {
Type: schema.TypeInt,
Computed: true,
Optional: true,
Description: `Port number to access on the container. Must be in the range 1 to 65535.
If not specified, defaults to the same value as container.ports[0].containerPort.`,
},
},
},
},
"initial_delay_seconds": {
Type: schema.TypeInt,
Optional: true,
Description: `Number of seconds after the container has started before the probe is initiated. Defaults to 0 seconds. Minimum value is 0. Maximum value for liveness probe is 3600. Maximum value for startup probe is 240. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes`,
Default: 0,
},
"period_seconds": {
Type: schema.TypeInt,
Optional: true,
Description: `How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1. Maximum value for liveness probe is 3600. Maximum value for startup probe is 240. Must be greater or equal than timeoutSeconds`,
Default: 10,
},
"tcp_socket": {
Type: schema.TypeList,
Optional: true,
Description: `TCPSocket specifies an action involving a TCP port. Exactly one of HTTPGet or TCPSocket must be specified.`,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"port": {
Type: schema.TypeInt,
Computed: true,
Optional: true,
Description: `Port number to access on the container. Must be in the range 1 to 65535.
If not specified, defaults to the same value as container.ports[0].containerPort.`,
},
},
},
},
"timeout_seconds": {
Type: schema.TypeInt,
Optional: true,
Description: `Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1. Maximum value is 3600. Must be smaller than periodSeconds. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes`,
Default: 1,
},
},
},
},
"volume_mounts": {
Type: schema.TypeList,
Optional: true,
Description: `Volume to mount into the container's filesystem.`,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"mount_path": {
Type: schema.TypeString,
Required: true,
Description: `Path within the container at which the volume should be mounted. Must not contain ':'. For Cloud SQL volumes, it can be left empty, or must otherwise be /cloudsql. All instances defined in the Volume will be available as /cloudsql/[instance]. For more information on Cloud SQL volumes, visit https://cloud.google.com/sql/docs/mysql/connect-run`,
},
"name": {
Type: schema.TypeString,
Required: true,
Description: `This must match the Name of a Volume.`,
},
},
},
},
"working_dir": {
Type: schema.TypeString,
Optional: true,
Description: `Container's working directory. If not specified, the container runtime's default will be used, which might be configured in the container image.`,
},
},
},
},
"encryption_key": {
Type: schema.TypeString,
Optional: true,
Description: `A reference to a customer managed encryption key (CMEK) to use to encrypt this container image. For more information, go to https://cloud.google.com/run/docs/securing/using-cmek`,
},
"execution_environment": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: verify.ValidateEnum([]string{"EXECUTION_ENVIRONMENT_GEN1", "EXECUTION_ENVIRONMENT_GEN2", ""}),
Description: `The sandbox environment to host this Revision. Possible values: ["EXECUTION_ENVIRONMENT_GEN1", "EXECUTION_ENVIRONMENT_GEN2"]`,
},
"labels": {
Type: schema.TypeMap,
Optional: true,
Description: `Unstructured key value map that can be used to organize and categorize objects. User-provided labels are shared with Google's billing system, so they can be used to filter, or break down billing charges by team, component, environment, state, etc.
For more information, visit https://cloud.google.com/resource-manager/docs/creating-managing-labels or https://cloud.google.com/run/docs/configuring/labels.
Cloud Run API v2 does not support labels with 'run.googleapis.com', 'cloud.googleapis.com', 'serving.knative.dev', or 'autoscaling.knative.dev' namespaces, and they will be rejected.
All system labels in v1 now have a corresponding field in v2 RevisionTemplate.`,
Elem: &schema.Schema{Type: schema.TypeString},
},
"max_instance_request_concurrency": {
Type: schema.TypeInt,
Computed: true,
Optional: true,
Description: `Sets the maximum number of requests that each serving instance can receive.`,
},
"revision": {
Type: schema.TypeString,
Optional: true,
Description: `The unique name for the revision. If this field is omitted, it will be automatically generated based on the Service name.`,
},
"scaling": {
Type: schema.TypeList,
Computed: true,
Optional: true,
Description: `Scaling settings for this Revision.`,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"max_instance_count": {
Type: schema.TypeInt,
Optional: true,
Description: `Maximum number of serving instances that this resource should have.`,
},
"min_instance_count": {
Type: schema.TypeInt,
Optional: true,
Description: `Minimum number of serving instances that this resource should have.`,
},
},
},
},
"service_account": {
Type: schema.TypeString,
Computed: true,
Optional: true,
Description: `Email address of the IAM service account associated with the revision of the service. The service account represents the identity of the running revision, and determines what permissions the revision has. If not provided, the revision will use the project's default service account.`,
},
"session_affinity": {
Type: schema.TypeBool,
Optional: true,
Description: `Enables session affinity. For more information, go to https://cloud.google.com/run/docs/configuring/session-affinity`,
},
"timeout": {
Type: schema.TypeString,
Computed: true,
Optional: true,
Description: `Max allowed time for an instance to respond to a request.
A duration in seconds with up to nine fractional digits, ending with 's'. Example: "3.5s".`,
},
"volumes": {
Type: schema.TypeList,
Optional: true,
Description: `A list of Volumes to make available to containers.`,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
Description: `Volume's name.`,
},
"cloud_sql_instance": {
Type: schema.TypeList,
Optional: true,
Description: `For Cloud SQL volumes, contains the specific instances that should be mounted. Visit https://cloud.google.com/sql/docs/mysql/connect-run for more information on how to connect Cloud SQL and Cloud Run.`,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"instances": {
Type: schema.TypeList,
Optional: true,
Description: `The Cloud SQL instance connection names, as can be found in https://console.cloud.google.com/sql/instances. Visit https://cloud.google.com/sql/docs/mysql/connect-run for more information on how to connect Cloud SQL and Cloud Run. Format: {project}:{location}:{instance}`,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
},
},
},
"empty_dir": {
Type: schema.TypeList,
Optional: true,
Description: `Ephemeral storage used as a shared volume.`,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"medium": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: verify.ValidateEnum([]string{"MEMORY", ""}),
Description: `The different types of medium supported for EmptyDir. Default value: "MEMORY" Possible values: ["MEMORY"]`,
Default: "MEMORY",
},
"size_limit": {
Type: schema.TypeString,
Optional: true,
Description: `Limit on the storage usable by this EmptyDir volume. The size limit is also applicable for memory medium. The maximum usage on memory medium EmptyDir would be the minimum value between the SizeLimit specified here and the sum of memory limits of all containers in a pod. This field's values are of the 'Quantity' k8s type: https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/quantity/. The default is nil which means that the limit is undefined. More info: https://kubernetes.io/docs/concepts/storage/volumes/#emptydir.`,
},
},
},
},
"secret": {
Type: schema.TypeList,
Optional: true,
Description: `Secret represents a secret that should populate this volume. More info: https://kubernetes.io/docs/concepts/storage/volumes#secret`,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"secret": {
Type: schema.TypeString,
Required: true,
Description: `The name of the secret in Cloud Secret Manager. Format: {secret} if the secret is in the same project. projects/{project}/secrets/{secret} if the secret is in a different project.`,
},
"default_mode": {
Type: schema.TypeInt,
Optional: true,
Description: `Integer representation of mode bits to use on created files by default. Must be a value between 0000 and 0777 (octal), defaulting to 0444. Directories within the path are not affected by this setting.`,
},
"items": {
Type: schema.TypeList,
Optional: true,
Description: `If unspecified, the volume will expose a file whose name is the secret, relative to VolumeMount.mount_path. If specified, the key will be used as the version to fetch from Cloud Secret Manager and the path will be the name of the file exposed in the volume. When items are defined, they must specify a path and a version.`,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"path": {
Type: schema.TypeString,
Required: true,
Description: `The relative path of the secret in the container.`,
},
"mode": {
Type: schema.TypeInt,
Optional: true,
Description: `Integer octal mode bits to use on this file, must be a value between 01 and 0777 (octal). If 0 or not set, the Volume's default mode will be used.`,
},
"version": {
Type: schema.TypeString,
Optional: true,
Description: `The Cloud Secret Manager secret version. Can be 'latest' for the latest value or an integer for a specific version`,
},
},
},
},
},
},
},
},
},
},
"vpc_access": {
Type: schema.TypeList,
Optional: true,
Description: `VPC Access configuration to use for this Task. For more information, visit https://cloud.google.com/run/docs/configuring/connecting-vpc.`,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"connector": {
Type: schema.TypeString,
Optional: true,
Description: `VPC Access connector name. Format: projects/{project}/locations/{location}/connectors/{connector}, where {project} can be project id or number.`,
},
"egress": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: verify.ValidateEnum([]string{"ALL_TRAFFIC", "PRIVATE_RANGES_ONLY", ""}),
Description: `Traffic VPC egress settings. Possible values: ["ALL_TRAFFIC", "PRIVATE_RANGES_ONLY"]`,
},
},
},
},
},
},
},
"annotations": {
Type: schema.TypeMap,
Optional: true,
Description: `Unstructured key value map that may be set by external tools to store and arbitrary metadata. They are not queryable and should be preserved when modifying objects.
Cloud Run API v2 does not support annotations with 'run.googleapis.com', 'cloud.googleapis.com', 'serving.knative.dev', or 'autoscaling.knative.dev' namespaces, and they will be rejected in new resources.
All system annotations in v1 now have a corresponding field in v2 Service.
This field follows Kubernetes annotations' namespacing, limits, and rules.`,
Elem: &schema.Schema{Type: schema.TypeString},
},
"binary_authorization": {
Type: schema.TypeList,
Optional: true,
Description: `Settings for the Binary Authorization feature.`,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"breakglass_justification": {
Type: schema.TypeString,
Optional: true,
Description: `If present, indicates to use Breakglass using this justification. If useDefault is False, then it must be empty. For more information on breakglass, see https://cloud.google.com/binary-authorization/docs/using-breakglass`,
},
"use_default": {
Type: schema.TypeBool,
Optional: true,
Description: `If True, indicates to use the default project's binary authorization policy. If False, binary authorization will be disabled.`,
},
},
},
},
"client": {
Type: schema.TypeString,
Optional: true,
Description: `Arbitrary identifier for the API client.`,
},
"client_version": {
Type: schema.TypeString,
Optional: true,
Description: `Arbitrary version identifier for the API client.`,
},
"custom_audiences": {
Type: schema.TypeList,
Optional: true,
Description: `One or more custom audiences that you want this service to support. Specify each custom audience as the full URL in a string. The custom audiences are encoded in the token and used to authenticate requests.
For more information, see https://cloud.google.com/run/docs/configuring/custom-audiences.`,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"description": {
Type: schema.TypeString,
Optional: true,
Description: `User-provided description of the Service. This field currently has a 512-character limit.`,
},
"ingress": {
Type: schema.TypeString,
Computed: true,
Optional: true,
ValidateFunc: verify.ValidateEnum([]string{"INGRESS_TRAFFIC_ALL", "INGRESS_TRAFFIC_INTERNAL_ONLY", "INGRESS_TRAFFIC_INTERNAL_LOAD_BALANCER", ""}),
Description: `Provides the ingress settings for this Service. On output, returns the currently observed ingress settings, or INGRESS_TRAFFIC_UNSPECIFIED if no revision is active. Possible values: ["INGRESS_TRAFFIC_ALL", "INGRESS_TRAFFIC_INTERNAL_ONLY", "INGRESS_TRAFFIC_INTERNAL_LOAD_BALANCER"]`,
},
"labels": {
Type: schema.TypeMap,
Optional: true,
Description: `Unstructured key value map that can be used to organize and categorize objects. User-provided labels are shared with Google's billing system, so they can be used to filter, or break down billing charges by team, component,
environment, state, etc. For more information, visit https://cloud.google.com/resource-manager/docs/creating-managing-labels or https://cloud.google.com/run/docs/configuring/labels.
Cloud Run API v2 does not support labels with 'run.googleapis.com', 'cloud.googleapis.com', 'serving.knative.dev', or 'autoscaling.knative.dev' namespaces, and they will be rejected.
All system labels in v1 now have a corresponding field in v2 Service.`,
Elem: &schema.Schema{Type: schema.TypeString},
},
"launch_stage": {
Type: schema.TypeString,
Computed: true,
Optional: true,
ValidateFunc: verify.ValidateEnum([]string{"UNIMPLEMENTED", "PRELAUNCH", "EARLY_ACCESS", "ALPHA", "BETA", "GA", "DEPRECATED", ""}),
Description: `The launch stage as defined by [Google Cloud Platform Launch Stages](https://cloud.google.com/products#product-launch-stages). Cloud Run supports ALPHA, BETA, and GA.
If no value is specified, GA is assumed. Set the launch stage to a preview stage on input to allow use of preview features in that stage. On read (or output), describes whether the resource uses preview features.
For example, if ALPHA is provided as input, but only BETA and GA-level features are used, this field will be BETA on output. Possible values: ["UNIMPLEMENTED", "PRELAUNCH", "EARLY_ACCESS", "ALPHA", "BETA", "GA", "DEPRECATED"]`,
},
"location": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: `The location of the cloud run service`,
},
"traffic": {
Type: schema.TypeList,
Computed: true,
Optional: true,
Description: `Specifies how to distribute traffic over a collection of Revisions belonging to the Service. If traffic is empty or not provided, defaults to 100% traffic to the latest Ready Revision.`,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"percent": {
Type: schema.TypeInt,
Computed: true,
Optional: true,
Description: `Specifies percent of the traffic to this Revision. This defaults to zero if unspecified.`,
},
"revision": {
Type: schema.TypeString,
Optional: true,
Description: `Revision to which to send this portion of traffic, if traffic allocation is by revision.`,
},
"tag": {
Type: schema.TypeString,
Optional: true,
Description: `Indicates a string to be part of the URI to exclusively reference this target.`,
},
"type": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: verify.ValidateEnum([]string{"TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST", "TRAFFIC_TARGET_ALLOCATION_TYPE_REVISION", ""}),
Description: `The allocation type for this traffic target. Possible values: ["TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST", "TRAFFIC_TARGET_ALLOCATION_TYPE_REVISION"]`,
},
},
},
},
"conditions": {
Type: schema.TypeList,
Computed: true,
Description: `The Conditions of all other associated sub-resources. They contain additional diagnostics information in case the Service does not reach its Serving state. See comments in reconciling for additional information on reconciliation process in Cloud Run.`,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"execution_reason": {
Type: schema.TypeString,
Computed: true,
Description: `A reason for the execution condition.`,
},
"last_transition_time": {
Type: schema.TypeString,
Computed: true,
Description: `Last time the condition transitioned from one status to another.
A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".`,
},
"message": {
Type: schema.TypeString,
Computed: true,
Description: `Human readable message indicating details about the current status.`,
},
"reason": {
Type: schema.TypeString,
Computed: true,
Description: `A common (service-level) reason for this condition.`,
},
"revision_reason": {
Type: schema.TypeString,
Computed: true,
Description: `A reason for the revision condition.`,
},
"severity": {
Type: schema.TypeString,
Computed: true,
Description: `How to interpret failures of this condition, one of Error, Warning, Info`,
},
"state": {
Type: schema.TypeString,
Computed: true,
Description: `State of the condition.`,
},
"type": {
Type: schema.TypeString,
Computed: true,
Description: `type is used to communicate the status of the reconciliation process. See also: https://github.com/knative/serving/blob/main/docs/spec/errors.md#error-conditions-and-reporting Types common to all resources include: * "Ready": True when the Resource is ready.`,
},
},
},
},
"create_time": {
Type: schema.TypeString,
Computed: true,
Description: `The creation time.`,
},
"creator": {
Type: schema.TypeString,
Computed: true,
Description: `Email address of the authenticated creator.`,
},
"delete_time": {
Type: schema.TypeString,
Computed: true,
Description: `The deletion time.`,
},
"etag": {
Type: schema.TypeString,
Computed: true,
Description: `A system-generated fingerprint for this version of the resource. May be used to detect modification conflict during updates.`,
},
"expire_time": {
Type: schema.TypeString,
Computed: true,
Description: `For a deleted resource, the time after which it will be permamently deleted.`,
},
"generation": {
Type: schema.TypeString,
Computed: true,
Description: `A number that monotonically increases every time the user modifies the desired state. Please note that unlike v1, this is an int64 value. As with most Google APIs, its JSON representation will be a string instead of an integer.`,
},
"last_modifier": {
Type: schema.TypeString,
Computed: true,
Description: `Email address of the last authenticated modifier.`,
},
"latest_created_revision": {
Type: schema.TypeString,
Computed: true,
Description: `Name of the last created revision. See comments in reconciling for additional information on reconciliation process in Cloud Run.`,
},
"latest_ready_revision": {
Type: schema.TypeString,
Computed: true,
Description: `Name of the latest revision that is serving traffic. See comments in reconciling for additional information on reconciliation process in Cloud Run.`,
},
"observed_generation": {
Type: schema.TypeString,
Computed: true,
Description: `The generation of this Service currently serving traffic. See comments in reconciling for additional information on reconciliation process in Cloud Run. Please note that unlike v1, this is an int64 value. As with most Google APIs, its JSON representation will be a string instead of an integer.`,
},
"reconciling": {
Type: schema.TypeBool,
Computed: true,
Description: `Returns true if the Service is currently being acted upon by the system to bring it into the desired state.
When a new Service is created, or an existing one is updated, Cloud Run will asynchronously perform all necessary steps to bring the Service to the desired serving state. This process is called reconciliation. While reconciliation is in process, observedGeneration, latest_ready_revison, trafficStatuses, and uri will have transient values that might mismatch the intended state: Once reconciliation is over (and this field is false), there are two possible outcomes: reconciliation succeeded and the serving state matches the Service, or there was an error, and reconciliation failed. This state can be found in terminalCondition.state.
If reconciliation succeeded, the following fields will match: traffic and trafficStatuses, observedGeneration and generation, latestReadyRevision and latestCreatedRevision.
If reconciliation failed, trafficStatuses, observedGeneration, and latestReadyRevision will have the state of the last serving revision, or empty for newly created Services. Additional information on the failure can be found in terminalCondition and conditions.`,
},
"terminal_condition": {
Type: schema.TypeList,
Computed: true,
Description: `The Condition of this Service, containing its readiness status, and detailed error information in case it did not reach a serving state. See comments in reconciling for additional information on reconciliation process in Cloud Run.`,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"execution_reason": {
Type: schema.TypeString,
Computed: true,
Description: `A reason for the execution condition.`,
},
"last_transition_time": {
Type: schema.TypeString,
Computed: true,
Description: `Last time the condition transitioned from one status to another.`,
},
"message": {
Type: schema.TypeString,
Computed: true,
Description: `Human readable message indicating details about the current status.`,
},
"reason": {
Type: schema.TypeString,
Computed: true,
Description: `A common (service-level) reason for this condition.`,
},
"revision_reason": {
Type: schema.TypeString,
Computed: true,
Description: `A reason for the revision condition.`,
},
"severity": {
Type: schema.TypeString,
Computed: true,
Description: `How to interpret failures of this condition, one of Error, Warning, Info`,
},
"state": {
Type: schema.TypeString,
Computed: true,
Description: `State of the condition.`,
},
"type": {
Type: schema.TypeString,
Computed: true,
Description: `type is used to communicate the status of the reconciliation process. See also: https://github.com/knative/serving/blob/main/docs/spec/errors.md#error-conditions-and-reporting Types common to all resources include: * "Ready": True when the Resource is ready.`,
},
},
},
},
"traffic_statuses": {
Type: schema.TypeList,
Computed: true,
Description: `Detailed status information for corresponding traffic targets. See comments in reconciling for additional information on reconciliation process in Cloud Run.`,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"percent": {
Type: schema.TypeInt,
Computed: true,
Description: `Specifies percent of the traffic to this Revision.`,
},
"revision": {
Type: schema.TypeString,
Computed: true,
Description: `Revision to which this traffic is sent.`,
},
"tag": {
Type: schema.TypeString,
Computed: true,
Description: `Indicates the string used in the URI to exclusively reference this target.`,
},
"type": {
Type: schema.TypeString,
Computed: true,
Description: `The allocation type for this traffic target.`,
},
"uri": {
Type: schema.TypeString,
Computed: true,
Description: `Displays the target URI.`,
},
},
},
},
"uid": {
Type: schema.TypeString,
Computed: true,
Description: `Server assigned unique identifier for the trigger. The value is a UUID4 string and guaranteed to remain unchanged until the resource is deleted.`,
},
"update_time": {
Type: schema.TypeString,
Computed: true,
Description: `The last-modified time.`,
},
"uri": {
Type: schema.TypeString,