blob: 7874c286effe3313910c2823f2846164021b1e2f [file] [log] [blame]
// 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"
"net/http"
"reflect"
"time"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/customdiff"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-provider-google-beta/google-beta/tpgresource"
transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport"
"github.com/hashicorp/terraform-provider-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),
},
CustomizeDiff: customdiff.All(
tpgresource.SetLabelsDiff,
tpgresource.SetAnnotationsDiff,
tpgresource.DefaultProviderProject,
),
Schema: map[string]*schema.Schema{
"location": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Description: `The location of the cloud run service`,
},
"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 are not supported in Cloud Run.`,
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.TypeSet,
Optional: true,
Description: `List of environment variables to set in the container.`,
Elem: cloudrunv2ServiceTemplateContainersContainersEnvSchema(),
// Default schema.HashSchema is used.
},
"liveness_probe": {
Type: schema.TypeList,
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,
Description: `TCPSocketAction describes an action based on opening a socket`,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"port": {
Type: schema.TypeInt,
Required: true,
Description: `Port number to access on the container. Must be in the range 1 to 65535.
If not specified, defaults to the exposed port of the container, which
is the value of 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,
},
},
},
},
"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`,
MaxItems: 1,
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 is only allocated during requests. True by default if the parent 'resources' field is not set. However, if
'resources' is set, this field must be explicitly set to true to preserve the default behavior.`,
},
"limits": {
Type: schema.TypeMap,
Computed: true,
Optional: true,
Description: `Only memory and CPU are supported. Use key 'cpu' for CPU limit and 'memory' for memory limit. 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.
If not specified or 0, defaults to 80 when requested CPU >= 1 and defaults to 1 when requested CPU < 1.`,
},
"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.`,
},
"service_mesh": {
Type: schema.TypeList,
Optional: true,
Description: `Enables Cloud Service Mesh for this Revision.`,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"mesh": {
Type: schema.TypeString,
Optional: true,
Description: `The Mesh resource name. For more information see https://cloud.google.com/service-mesh/docs/reference/network-services/rest/v1/projects.locations.meshes#resource:-mesh.`,
},
},
},
},
"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,
ValidateFunc: verify.ValidateRegexp(`^[0-9]+(?:\.[0-9]{1,9})?s$`),
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.TypeSet,
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,
},
Set: schema.HashString,
},
},
},
},
"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.`,
},
},
},
},
"gcs": {
Type: schema.TypeList,
Optional: true,
Description: `Cloud Storage bucket mounted as a volume using GCSFuse. This feature is only supported in the gen2 execution environment.`,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"bucket": {
Type: schema.TypeString,
Required: true,
Description: `GCS Bucket name`,
},
"read_only": {
Type: schema.TypeBool,
Optional: true,
Description: `If true, mount the GCS bucket as read-only`,
},
},
},
},
"nfs": {
Type: schema.TypeList,
Optional: true,
Description: `Represents an NFS mount.`,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"path": {
Type: schema.TypeString,
Required: true,
Description: `Path that is exported by the NFS server.`,
},
"server": {
Type: schema.TypeString,
Required: true,
Description: `Hostname or IP address of the NFS server`,
},
"read_only": {
Type: schema.TypeBool,
Optional: true,
Description: `If true, mount the NFS volume as read only`,
},
},
},
},
"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,
Computed: true,
Optional: true,
ValidateFunc: verify.ValidateEnum([]string{"ALL_TRAFFIC", "PRIVATE_RANGES_ONLY", ""}),
Description: `Traffic VPC egress settings. Possible values: ["ALL_TRAFFIC", "PRIVATE_RANGES_ONLY"]`,
},
"network_interfaces": {
Type: schema.TypeList,
Optional: true,
Description: `Direct VPC egress settings. Currently only single network interface is supported.`,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"network": {
Type: schema.TypeString,
Computed: true,
Optional: true,
Description: `The VPC network that the Cloud Run resource will be able to send traffic to. At least one of network or subnetwork must be specified. If both
network and subnetwork are specified, the given VPC subnetwork must belong to the given VPC network. If network is not specified, it will be
looked up from the subnetwork.`,
},
"subnetwork": {
Type: schema.TypeString,
Computed: true,
Optional: true,
Description: `The VPC subnetwork that the Cloud Run resource will get IPs from. At least one of network or subnetwork must be specified. If both
network and subnetwork are specified, the given VPC subnetwork must belong to the given VPC network. If subnetwork is not specified, the
subnetwork with the same name with the network will be used.`,
},
"tags": {
Type: schema.TypeList,
Optional: true,
Description: `Network tags applied to this Cloud Run service.`,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
},
},
},
},
},
},
},
},
},
"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.
**Note**: This field is non-authoritative, and will only manage the annotations present in your configuration.
Please refer to the field 'effective_annotations' for all of the annotations present on the resource.`,
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`,
},
"policy": {
Type: schema.TypeString,
Optional: true,
Description: `The path to a binary authorization policy. Format: projects/{project}/platforms/cloudRun/{policy-name}`,
ConflictsWith: []string{},
},
"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.`,
ConflictsWith: []string{},
},
},
},
},
"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,
},
},
"default_uri_disabled": {
Type: schema.TypeBool,
Optional: true,
Description: `Disables public resolution of the default URI of this service.`,
},
"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.
**Note**: This field is non-authoritative, and will only manage the labels present in your configuration.
Please refer to the field 'effective_labels' for all of the labels present on the resource.`,
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"]`,
},
"scaling": {
Type: schema.TypeList,
Optional: true,
Description: `Scaling settings that apply to the whole service`,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"min_instance_count": {
Type: schema.TypeInt,
Optional: true,
Description: `Minimum number of instances for the service, to be divided among all revisions receiving traffic.`,
},
},
},
},
"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.`,
},
"effective_annotations": {
Type: schema.TypeMap,
Computed: true,
Description: `All of annotations (key/value pairs) present on the resource in GCP, including the annotations configured through Terraform, other clients and services.`,
Elem: &schema.Schema{Type: schema.TypeString},
},
"effective_labels": {
Type: schema.TypeMap,
Computed: true,
Description: `All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Terraform, other clients and services.`,
Elem: &schema.Schema{Type: schema.TypeString},
},
"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.`,
},
},
},
},
"terraform_labels": {
Type: schema.TypeMap,
Computed: true,
Description: `The combination of labels configured directly on the resource
and default labels configured on the provider.`,
Elem: &schema.Schema{Type: schema.TypeString},
},
"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,
Computed: true,
Description: `The main URI in which this Service is serving traffic.`,
},
"deletion_protection": {
Type: schema.TypeBool,
Optional: true,
Description: `Whether Terraform will be prevented from destroying the service. Defaults to true.
When a'terraform destroy' or 'terraform apply' would delete the service,
the command will fail if this field is not set to false in Terraform state.
When the field is set to true or unset in Terraform state, a 'terraform apply'
or 'terraform destroy' that would delete the service will fail.
When the field is set to false, deleting the service is allowed.`,
Default: true,
},
"project": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
},
UseJSONNumber: true,
}
}
func cloudrunv2ServiceTemplateContainersContainersEnvSchema() *schema.Resource {
return &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 may not exceed 32768 characters.`,
},
"value": {
Type: schema.TypeString,
Optional: true,
Description: `Literal value of the environment variable. Defaults to "" and the maximum allowed length is 32768 characters. Variable references are not supported in Cloud Run.`,
},
"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.`,
},
},
},
},
},
},
},
},
}
}
func resourceCloudRunV2ServiceCreate(d *schema.ResourceData, meta interface{}) error {
config := meta.(*transport_tpg.Config)
userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent)
if err != nil {
return err
}
obj := make(map[string]interface{})
descriptionProp, err := expandCloudRunV2ServiceDescription(d.Get("description"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("description"); !tpgresource.IsEmptyValue(reflect.ValueOf(descriptionProp)) && (ok || !reflect.DeepEqual(v, descriptionProp)) {
obj["description"] = descriptionProp
}
clientProp, err := expandCloudRunV2ServiceClient(d.Get("client"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("client"); !tpgresource.IsEmptyValue(reflect.ValueOf(clientProp)) && (ok || !reflect.DeepEqual(v, clientProp)) {
obj["client"] = clientProp
}
clientVersionProp, err := expandCloudRunV2ServiceClientVersion(d.Get("client_version"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("client_version"); !tpgresource.IsEmptyValue(reflect.ValueOf(clientVersionProp)) && (ok || !reflect.DeepEqual(v, clientVersionProp)) {
obj["clientVersion"] = clientVersionProp
}
ingressProp, err := expandCloudRunV2ServiceIngress(d.Get("ingress"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("ingress"); !tpgresource.IsEmptyValue(reflect.ValueOf(ingressProp)) && (ok || !reflect.DeepEqual(v, ingressProp)) {
obj["ingress"] = ingressProp
}
launchStageProp, err := expandCloudRunV2ServiceLaunchStage(d.Get("launch_stage"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("launch_stage"); !tpgresource.IsEmptyValue(reflect.ValueOf(launchStageProp)) && (ok || !reflect.DeepEqual(v, launchStageProp)) {
obj["launchStage"] = launchStageProp
}
binaryAuthorizationProp, err := expandCloudRunV2ServiceBinaryAuthorization(d.Get("binary_authorization"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("binary_authorization"); !tpgresource.IsEmptyValue(reflect.ValueOf(binaryAuthorizationProp)) && (ok || !reflect.DeepEqual(v, binaryAuthorizationProp)) {
obj["binaryAuthorization"] = binaryAuthorizationProp
}
customAudiencesProp, err := expandCloudRunV2ServiceCustomAudiences(d.Get("custom_audiences"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("custom_audiences"); !tpgresource.IsEmptyValue(reflect.ValueOf(customAudiencesProp)) && (ok || !reflect.DeepEqual(v, customAudiencesProp)) {
obj["customAudiences"] = customAudiencesProp
}
scalingProp, err := expandCloudRunV2ServiceScaling(d.Get("scaling"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("scaling"); !tpgresource.IsEmptyValue(reflect.ValueOf(scalingProp)) && (ok || !reflect.DeepEqual(v, scalingProp)) {
obj["scaling"] = scalingProp
}
defaultUriDisabledProp, err := expandCloudRunV2ServiceDefaultUriDisabled(d.Get("default_uri_disabled"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("default_uri_disabled"); !tpgresource.IsEmptyValue(reflect.ValueOf(defaultUriDisabledProp)) && (ok || !reflect.DeepEqual(v, defaultUriDisabledProp)) {
obj["defaultUriDisabled"] = defaultUriDisabledProp
}
templateProp, err := expandCloudRunV2ServiceTemplate(d.Get("template"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("template"); !tpgresource.IsEmptyValue(reflect.ValueOf(templateProp)) && (ok || !reflect.DeepEqual(v, templateProp)) {
obj["template"] = templateProp
}
trafficProp, err := expandCloudRunV2ServiceTraffic(d.Get("traffic"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("traffic"); !tpgresource.IsEmptyValue(reflect.ValueOf(trafficProp)) && (ok || !reflect.DeepEqual(v, trafficProp)) {
obj["traffic"] = trafficProp
}
labelsProp, err := expandCloudRunV2ServiceEffectiveLabels(d.Get("effective_labels"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("effective_labels"); !tpgresource.IsEmptyValue(reflect.ValueOf(labelsProp)) && (ok || !reflect.DeepEqual(v, labelsProp)) {
obj["labels"] = labelsProp
}
annotationsProp, err := expandCloudRunV2ServiceEffectiveAnnotations(d.Get("effective_annotations"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("effective_annotations"); !tpgresource.IsEmptyValue(reflect.ValueOf(annotationsProp)) && (ok || !reflect.DeepEqual(v, annotationsProp)) {
obj["annotations"] = annotationsProp
}
url, err := tpgresource.ReplaceVars(d, config, "{{CloudRunV2BasePath}}projects/{{project}}/locations/{{location}}/services?serviceId={{name}}")
if err != nil {
return err
}
log.Printf("[DEBUG] Creating new Service: %#v", obj)
billingProject := ""
project, err := tpgresource.GetProject(d, config)
if err != nil {
return fmt.Errorf("Error fetching project for Service: %s", err)
}
billingProject = project
// err == nil indicates that the billing_project value was found
if bp, err := tpgresource.GetBillingProject(d, config); err == nil {
billingProject = bp
}
headers := make(http.Header)
res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{
Config: config,
Method: "POST",
Project: billingProject,
RawURL: url,
UserAgent: userAgent,
Body: obj,
Timeout: d.Timeout(schema.TimeoutCreate),
Headers: headers,
})
if err != nil {
return fmt.Errorf("Error creating Service: %s", err)
}
// Store the ID now
id, err := tpgresource.ReplaceVars(d, config, "projects/{{project}}/locations/{{location}}/services/{{name}}")
if err != nil {
return fmt.Errorf("Error constructing id: %s", err)
}
d.SetId(id)
// Use the resource in the operation response to populate
// identity fields and d.Id() before read
var opRes map[string]interface{}
err = CloudRunV2OperationWaitTimeWithResponse(
config, res, &opRes, project, "Creating Service", userAgent,
d.Timeout(schema.TimeoutCreate))
if err != nil {
return fmt.Errorf("Error waiting to create Service: %s", err)
}
// This may have caused the ID to update - update it if so.
id, err = tpgresource.ReplaceVars(d, config, "projects/{{project}}/locations/{{location}}/services/{{name}}")
if err != nil {
return fmt.Errorf("Error constructing id: %s", err)
}
d.SetId(id)
log.Printf("[DEBUG] Finished creating Service %q: %#v", d.Id(), res)
return resourceCloudRunV2ServiceRead(d, meta)
}
func resourceCloudRunV2ServiceRead(d *schema.ResourceData, meta interface{}) error {
config := meta.(*transport_tpg.Config)
userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent)
if err != nil {
return err
}
url, err := tpgresource.ReplaceVars(d, config, "{{CloudRunV2BasePath}}projects/{{project}}/locations/{{location}}/services/{{name}}")
if err != nil {
return err
}
billingProject := ""
project, err := tpgresource.GetProject(d, config)
if err != nil {
return fmt.Errorf("Error fetching project for Service: %s", err)
}
billingProject = project
// err == nil indicates that the billing_project value was found
if bp, err := tpgresource.GetBillingProject(d, config); err == nil {
billingProject = bp
}
headers := make(http.Header)
res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{
Config: config,
Method: "GET",
Project: billingProject,
RawURL: url,
UserAgent: userAgent,
Headers: headers,
})
if err != nil {
return transport_tpg.HandleNotFoundError(err, d, fmt.Sprintf("CloudRunV2Service %q", d.Id()))
}
// Explicitly set virtual fields to default values if unset
if _, ok := d.GetOkExists("deletion_protection"); !ok {
if err := d.Set("deletion_protection", true); err != nil {
return fmt.Errorf("Error setting deletion_protection: %s", err)
}
}
if err := d.Set("project", project); err != nil {
return fmt.Errorf("Error reading Service: %s", err)
}
if err := d.Set("description", flattenCloudRunV2ServiceDescription(res["description"], d, config)); err != nil {
return fmt.Errorf("Error reading Service: %s", err)
}
if err := d.Set("uid", flattenCloudRunV2ServiceUid(res["uid"], d, config)); err != nil {
return fmt.Errorf("Error reading Service: %s", err)
}
if err := d.Set("generation", flattenCloudRunV2ServiceGeneration(res["generation"], d, config)); err != nil {
return fmt.Errorf("Error reading Service: %s", err)
}
if err := d.Set("labels", flattenCloudRunV2ServiceLabels(res["labels"], d, config)); err != nil {
return fmt.Errorf("Error reading Service: %s", err)
}
if err := d.Set("annotations", flattenCloudRunV2ServiceAnnotations(res["annotations"], d, config)); err != nil {
return fmt.Errorf("Error reading Service: %s", err)
}
if err := d.Set("create_time", flattenCloudRunV2ServiceCreateTime(res["createTime"], d, config)); err != nil {
return fmt.Errorf("Error reading Service: %s", err)
}
if err := d.Set("update_time", flattenCloudRunV2ServiceUpdateTime(res["updateTime"], d, config)); err != nil {
return fmt.Errorf("Error reading Service: %s", err)
}
if err := d.Set("delete_time", flattenCloudRunV2ServiceDeleteTime(res["deleteTime"], d, config)); err != nil {
return fmt.Errorf("Error reading Service: %s", err)
}
if err := d.Set("expire_time", flattenCloudRunV2ServiceExpireTime(res["expireTime"], d, config)); err != nil {
return fmt.Errorf("Error reading Service: %s", err)
}
if err := d.Set("creator", flattenCloudRunV2ServiceCreator(res["creator"], d, config)); err != nil {
return fmt.Errorf("Error reading Service: %s", err)
}
if err := d.Set("last_modifier", flattenCloudRunV2ServiceLastModifier(res["lastModifier"], d, config)); err != nil {
return fmt.Errorf("Error reading Service: %s", err)
}
if err := d.Set("client", flattenCloudRunV2ServiceClient(res["client"], d, config)); err != nil {
return fmt.Errorf("Error reading Service: %s", err)
}
if err := d.Set("client_version", flattenCloudRunV2ServiceClientVersion(res["clientVersion"], d, config)); err != nil {
return fmt.Errorf("Error reading Service: %s", err)
}
if err := d.Set("ingress", flattenCloudRunV2ServiceIngress(res["ingress"], d, config)); err != nil {
return fmt.Errorf("Error reading Service: %s", err)
}
if err := d.Set("launch_stage", flattenCloudRunV2ServiceLaunchStage(res["launchStage"], d, config)); err != nil {
return fmt.Errorf("Error reading Service: %s", err)
}
if err := d.Set("binary_authorization", flattenCloudRunV2ServiceBinaryAuthorization(res["binaryAuthorization"], d, config)); err != nil {
return fmt.Errorf("Error reading Service: %s", err)
}
if err := d.Set("custom_audiences", flattenCloudRunV2ServiceCustomAudiences(res["customAudiences"], d, config)); err != nil {
return fmt.Errorf("Error reading Service: %s", err)
}
if err := d.Set("scaling", flattenCloudRunV2ServiceScaling(res["scaling"], d, config)); err != nil {
return fmt.Errorf("Error reading Service: %s", err)
}
if err := d.Set("default_uri_disabled", flattenCloudRunV2ServiceDefaultUriDisabled(res["defaultUriDisabled"], d, config)); err != nil {
return fmt.Errorf("Error reading Service: %s", err)
}
if err := d.Set("template", flattenCloudRunV2ServiceTemplate(res["template"], d, config)); err != nil {
return fmt.Errorf("Error reading Service: %s", err)
}
if err := d.Set("traffic", flattenCloudRunV2ServiceTraffic(res["traffic"], d, config)); err != nil {
return fmt.Errorf("Error reading Service: %s", err)
}
if err := d.Set("observed_generation", flattenCloudRunV2ServiceObservedGeneration(res["observedGeneration"], d, config)); err != nil {
return fmt.Errorf("Error reading Service: %s", err)
}
if err := d.Set("terminal_condition", flattenCloudRunV2ServiceTerminalCondition(res["terminalCondition"], d, config)); err != nil {
return fmt.Errorf("Error reading Service: %s", err)
}
if err := d.Set("conditions", flattenCloudRunV2ServiceConditions(res["conditions"], d, config)); err != nil {
return fmt.Errorf("Error reading Service: %s", err)
}
if err := d.Set("latest_ready_revision", flattenCloudRunV2ServiceLatestReadyRevision(res["latestReadyRevision"], d, config)); err != nil {
return fmt.Errorf("Error reading Service: %s", err)
}
if err := d.Set("latest_created_revision", flattenCloudRunV2ServiceLatestCreatedRevision(res["latestCreatedRevision"], d, config)); err != nil {
return fmt.Errorf("Error reading Service: %s", err)
}
if err := d.Set("traffic_statuses", flattenCloudRunV2ServiceTrafficStatuses(res["trafficStatuses"], d, config)); err != nil {
return fmt.Errorf("Error reading Service: %s", err)
}
if err := d.Set("uri", flattenCloudRunV2ServiceUri(res["uri"], d, config)); err != nil {
return fmt.Errorf("Error reading Service: %s", err)
}
if err := d.Set("reconciling", flattenCloudRunV2ServiceReconciling(res["reconciling"], d, config)); err != nil {
return fmt.Errorf("Error reading Service: %s", err)
}
if err := d.Set("etag", flattenCloudRunV2ServiceEtag(res["etag"], d, config)); err != nil {
return fmt.Errorf("Error reading Service: %s", err)
}
if err := d.Set("terraform_labels", flattenCloudRunV2ServiceTerraformLabels(res["labels"], d, config)); err != nil {
return fmt.Errorf("Error reading Service: %s", err)
}
if err := d.Set("effective_labels", flattenCloudRunV2ServiceEffectiveLabels(res["labels"], d, config)); err != nil {
return fmt.Errorf("Error reading Service: %s", err)
}
if err := d.Set("effective_annotations", flattenCloudRunV2ServiceEffectiveAnnotations(res["annotations"], d, config)); err != nil {
return fmt.Errorf("Error reading Service: %s", err)
}
return nil
}
func resourceCloudRunV2ServiceUpdate(d *schema.ResourceData, meta interface{}) error {
config := meta.(*transport_tpg.Config)
userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent)
if err != nil {
return err
}
billingProject := ""
project, err := tpgresource.GetProject(d, config)
if err != nil {
return fmt.Errorf("Error fetching project for Service: %s", err)
}
billingProject = project
obj := make(map[string]interface{})
descriptionProp, err := expandCloudRunV2ServiceDescription(d.Get("description"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("description"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, descriptionProp)) {
obj["description"] = descriptionProp
}
clientProp, err := expandCloudRunV2ServiceClient(d.Get("client"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("client"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, clientProp)) {
obj["client"] = clientProp
}
clientVersionProp, err := expandCloudRunV2ServiceClientVersion(d.Get("client_version"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("client_version"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, clientVersionProp)) {
obj["clientVersion"] = clientVersionProp
}
ingressProp, err := expandCloudRunV2ServiceIngress(d.Get("ingress"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("ingress"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, ingressProp)) {
obj["ingress"] = ingressProp
}
launchStageProp, err := expandCloudRunV2ServiceLaunchStage(d.Get("launch_stage"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("launch_stage"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, launchStageProp)) {
obj["launchStage"] = launchStageProp
}
binaryAuthorizationProp, err := expandCloudRunV2ServiceBinaryAuthorization(d.Get("binary_authorization"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("binary_authorization"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, binaryAuthorizationProp)) {
obj["binaryAuthorization"] = binaryAuthorizationProp
}
customAudiencesProp, err := expandCloudRunV2ServiceCustomAudiences(d.Get("custom_audiences"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("custom_audiences"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, customAudiencesProp)) {
obj["customAudiences"] = customAudiencesProp
}
scalingProp, err := expandCloudRunV2ServiceScaling(d.Get("scaling"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("scaling"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, scalingProp)) {
obj["scaling"] = scalingProp
}
defaultUriDisabledProp, err := expandCloudRunV2ServiceDefaultUriDisabled(d.Get("default_uri_disabled"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("default_uri_disabled"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, defaultUriDisabledProp)) {
obj["defaultUriDisabled"] = defaultUriDisabledProp
}
templateProp, err := expandCloudRunV2ServiceTemplate(d.Get("template"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("template"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, templateProp)) {
obj["template"] = templateProp
}
trafficProp, err := expandCloudRunV2ServiceTraffic(d.Get("traffic"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("traffic"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, trafficProp)) {
obj["traffic"] = trafficProp
}
labelsProp, err := expandCloudRunV2ServiceEffectiveLabels(d.Get("effective_labels"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("effective_labels"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, labelsProp)) {
obj["labels"] = labelsProp
}
annotationsProp, err := expandCloudRunV2ServiceEffectiveAnnotations(d.Get("effective_annotations"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("effective_annotations"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, annotationsProp)) {
obj["annotations"] = annotationsProp
}
url, err := tpgresource.ReplaceVars(d, config, "{{CloudRunV2BasePath}}projects/{{project}}/locations/{{location}}/services/{{name}}")
if err != nil {
return err
}
log.Printf("[DEBUG] Updating Service %q: %#v", d.Id(), obj)
headers := make(http.Header)
// err == nil indicates that the billing_project value was found
if bp, err := tpgresource.GetBillingProject(d, config); err == nil {
billingProject = bp
}
res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{
Config: config,
Method: "PATCH",
Project: billingProject,
RawURL: url,
UserAgent: userAgent,
Body: obj,
Timeout: d.Timeout(schema.TimeoutUpdate),
Headers: headers,
})
if err != nil {
return fmt.Errorf("Error updating Service %q: %s", d.Id(), err)
} else {
log.Printf("[DEBUG] Finished updating Service %q: %#v", d.Id(), res)
}
err = CloudRunV2OperationWaitTime(
config, res, project, "Updating Service", userAgent,
d.Timeout(schema.TimeoutUpdate))
if err != nil {
return err
}
return resourceCloudRunV2ServiceRead(d, meta)
}
func resourceCloudRunV2ServiceDelete(d *schema.ResourceData, meta interface{}) error {
config := meta.(*transport_tpg.Config)
userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent)
if err != nil {
return err
}
billingProject := ""
project, err := tpgresource.GetProject(d, config)
if err != nil {
return fmt.Errorf("Error fetching project for Service: %s", err)
}
billingProject = project
url, err := tpgresource.ReplaceVars(d, config, "{{CloudRunV2BasePath}}projects/{{project}}/locations/{{location}}/services/{{name}}")
if err != nil {
return err
}
var obj map[string]interface{}
// err == nil indicates that the billing_project value was found
if bp, err := tpgresource.GetBillingProject(d, config); err == nil {
billingProject = bp
}
headers := make(http.Header)
if d.Get("deletion_protection").(bool) {
return fmt.Errorf("cannot destroy service without setting deletion_protection=false and running `terraform apply`")
}
log.Printf("[DEBUG] Deleting Service %q", d.Id())
res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{
Config: config,
Method: "DELETE",
Project: billingProject,
RawURL: url,
UserAgent: userAgent,
Body: obj,
Timeout: d.Timeout(schema.TimeoutDelete),
Headers: headers,
})
if err != nil {
return transport_tpg.HandleNotFoundError(err, d, "Service")
}
err = CloudRunV2OperationWaitTime(
config, res, project, "Deleting Service", userAgent,
d.Timeout(schema.TimeoutDelete))
if err != nil {
return err
}
log.Printf("[DEBUG] Finished deleting Service %q: %#v", d.Id(), res)
return nil
}
func resourceCloudRunV2ServiceImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
config := meta.(*transport_tpg.Config)
if err := tpgresource.ParseImportId([]string{
"^projects/(?P<project>[^/]+)/locations/(?P<location>[^/]+)/services/(?P<name>[^/]+)$",
"^(?P<project>[^/]+)/(?P<location>[^/]+)/(?P<name>[^/]+)$",
"^(?P<location>[^/]+)/(?P<name>[^/]+)$",
}, d, config); err != nil {
return nil, err
}
// Replace import id for the resource id
id, err := tpgresource.ReplaceVars(d, config, "projects/{{project}}/locations/{{location}}/services/{{name}}")
if err != nil {
return nil, fmt.Errorf("Error constructing id: %s", err)
}
d.SetId(id)
// Explicitly set virtual fields to default values on import
if err := d.Set("deletion_protection", true); err != nil {
return nil, fmt.Errorf("Error setting deletion_protection: %s", err)
}
return []*schema.ResourceData{d}, nil
}
func flattenCloudRunV2ServiceDescription(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceUid(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceGeneration(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceLabels(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return v
}
transformed := make(map[string]interface{})
if l, ok := d.GetOkExists("labels"); ok {
for k := range l.(map[string]interface{}) {
transformed[k] = v.(map[string]interface{})[k]
}
}
return transformed
}
func flattenCloudRunV2ServiceAnnotations(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return v
}
transformed := make(map[string]interface{})
if l, ok := d.GetOkExists("annotations"); ok {
for k := range l.(map[string]interface{}) {
transformed[k] = v.(map[string]interface{})[k]
}
}
return transformed
}
func flattenCloudRunV2ServiceCreateTime(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceUpdateTime(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceDeleteTime(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceExpireTime(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceCreator(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceLastModifier(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceClient(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceClientVersion(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceIngress(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceLaunchStage(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceBinaryAuthorization(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return nil
}
original := v.(map[string]interface{})
if len(original) == 0 {
return nil
}
transformed := make(map[string]interface{})
transformed["breakglass_justification"] =
flattenCloudRunV2ServiceBinaryAuthorizationBreakglassJustification(original["breakglassJustification"], d, config)
transformed["use_default"] =
flattenCloudRunV2ServiceBinaryAuthorizationUseDefault(original["useDefault"], d, config)
transformed["policy"] =
flattenCloudRunV2ServiceBinaryAuthorizationPolicy(original["policy"], d, config)
return []interface{}{transformed}
}
func flattenCloudRunV2ServiceBinaryAuthorizationBreakglassJustification(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceBinaryAuthorizationUseDefault(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceBinaryAuthorizationPolicy(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceCustomAudiences(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceScaling(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return nil
}
original := v.(map[string]interface{})
if len(original) == 0 {
return nil
}
transformed := make(map[string]interface{})
transformed["min_instance_count"] =
flattenCloudRunV2ServiceScalingMinInstanceCount(original["minInstanceCount"], d, config)
return []interface{}{transformed}
}
func flattenCloudRunV2ServiceScalingMinInstanceCount(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
// Handles the string fixed64 format
if strVal, ok := v.(string); ok {
if intVal, err := tpgresource.StringToFixed64(strVal); err == nil {
return intVal
}
}
// number values are represented as float64
if floatVal, ok := v.(float64); ok {
intVal := int(floatVal)
return intVal
}
return v // let terraform core handle it otherwise
}
func flattenCloudRunV2ServiceDefaultUriDisabled(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplate(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return nil
}
original := v.(map[string]interface{})
if len(original) == 0 {
return nil
}
transformed := make(map[string]interface{})
transformed["revision"] =
flattenCloudRunV2ServiceTemplateRevision(original["revision"], d, config)
transformed["labels"] =
flattenCloudRunV2ServiceTemplateLabels(original["labels"], d, config)
transformed["annotations"] =
flattenCloudRunV2ServiceTemplateAnnotations(original["annotations"], d, config)
transformed["scaling"] =
flattenCloudRunV2ServiceTemplateScaling(original["scaling"], d, config)
transformed["vpc_access"] =
flattenCloudRunV2ServiceTemplateVpcAccess(original["vpcAccess"], d, config)
transformed["timeout"] =
flattenCloudRunV2ServiceTemplateTimeout(original["timeout"], d, config)
transformed["service_account"] =
flattenCloudRunV2ServiceTemplateServiceAccount(original["serviceAccount"], d, config)
transformed["containers"] =
flattenCloudRunV2ServiceTemplateContainers(original["containers"], d, config)
transformed["volumes"] =
flattenCloudRunV2ServiceTemplateVolumes(original["volumes"], d, config)
transformed["execution_environment"] =
flattenCloudRunV2ServiceTemplateExecutionEnvironment(original["executionEnvironment"], d, config)
transformed["encryption_key"] =
flattenCloudRunV2ServiceTemplateEncryptionKey(original["encryptionKey"], d, config)
transformed["max_instance_request_concurrency"] =
flattenCloudRunV2ServiceTemplateMaxInstanceRequestConcurrency(original["maxInstanceRequestConcurrency"], d, config)
transformed["session_affinity"] =
flattenCloudRunV2ServiceTemplateSessionAffinity(original["sessionAffinity"], d, config)
transformed["service_mesh"] =
flattenCloudRunV2ServiceTemplateServiceMesh(original["serviceMesh"], d, config)
return []interface{}{transformed}
}
func flattenCloudRunV2ServiceTemplateRevision(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateLabels(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateAnnotations(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateScaling(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return nil
}
original := v.(map[string]interface{})
if len(original) == 0 {
return nil
}
transformed := make(map[string]interface{})
transformed["min_instance_count"] =
flattenCloudRunV2ServiceTemplateScalingMinInstanceCount(original["minInstanceCount"], d, config)
transformed["max_instance_count"] =
flattenCloudRunV2ServiceTemplateScalingMaxInstanceCount(original["maxInstanceCount"], d, config)
return []interface{}{transformed}
}
func flattenCloudRunV2ServiceTemplateScalingMinInstanceCount(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
// Handles the string fixed64 format
if strVal, ok := v.(string); ok {
if intVal, err := tpgresource.StringToFixed64(strVal); err == nil {
return intVal
}
}
// number values are represented as float64
if floatVal, ok := v.(float64); ok {
intVal := int(floatVal)
return intVal
}
return v // let terraform core handle it otherwise
}
func flattenCloudRunV2ServiceTemplateScalingMaxInstanceCount(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
// Handles the string fixed64 format
if strVal, ok := v.(string); ok {
if intVal, err := tpgresource.StringToFixed64(strVal); err == nil {
return intVal
}
}
// number values are represented as float64
if floatVal, ok := v.(float64); ok {
intVal := int(floatVal)
return intVal
}
return v // let terraform core handle it otherwise
}
func flattenCloudRunV2ServiceTemplateVpcAccess(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return nil
}
original := v.(map[string]interface{})
if len(original) == 0 {
return nil
}
transformed := make(map[string]interface{})
transformed["connector"] =
flattenCloudRunV2ServiceTemplateVpcAccessConnector(original["connector"], d, config)
transformed["egress"] =
flattenCloudRunV2ServiceTemplateVpcAccessEgress(original["egress"], d, config)
transformed["network_interfaces"] =
flattenCloudRunV2ServiceTemplateVpcAccessNetworkInterfaces(original["networkInterfaces"], d, config)
return []interface{}{transformed}
}
func flattenCloudRunV2ServiceTemplateVpcAccessConnector(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateVpcAccessEgress(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateVpcAccessNetworkInterfaces(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return v
}
l := v.([]interface{})
transformed := make([]interface{}, 0, len(l))
for _, raw := range l {
original := raw.(map[string]interface{})
if len(original) < 1 {
// Do not include empty json objects coming back from the api
continue
}
transformed = append(transformed, map[string]interface{}{
"network": flattenCloudRunV2ServiceTemplateVpcAccessNetworkInterfacesNetwork(original["network"], d, config),
"subnetwork": flattenCloudRunV2ServiceTemplateVpcAccessNetworkInterfacesSubnetwork(original["subnetwork"], d, config),
"tags": flattenCloudRunV2ServiceTemplateVpcAccessNetworkInterfacesTags(original["tags"], d, config),
})
}
return transformed
}
func flattenCloudRunV2ServiceTemplateVpcAccessNetworkInterfacesNetwork(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateVpcAccessNetworkInterfacesSubnetwork(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateVpcAccessNetworkInterfacesTags(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateTimeout(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateServiceAccount(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateContainers(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return v
}
l := v.([]interface{})
transformed := make([]interface{}, 0, len(l))
for _, raw := range l {
original := raw.(map[string]interface{})
if len(original) < 1 {
// Do not include empty json objects coming back from the api
continue
}
transformed = append(transformed, map[string]interface{}{
"name": flattenCloudRunV2ServiceTemplateContainersName(original["name"], d, config),
"image": flattenCloudRunV2ServiceTemplateContainersImage(original["image"], d, config),
"command": flattenCloudRunV2ServiceTemplateContainersCommand(original["command"], d, config),
"args": flattenCloudRunV2ServiceTemplateContainersArgs(original["args"], d, config),
"env": flattenCloudRunV2ServiceTemplateContainersEnv(original["env"], d, config),
"resources": flattenCloudRunV2ServiceTemplateContainersResources(original["resources"], d, config),
"ports": flattenCloudRunV2ServiceTemplateContainersPorts(original["ports"], d, config),
"volume_mounts": flattenCloudRunV2ServiceTemplateContainersVolumeMounts(original["volumeMounts"], d, config),
"working_dir": flattenCloudRunV2ServiceTemplateContainersWorkingDir(original["workingDir"], d, config),
"liveness_probe": flattenCloudRunV2ServiceTemplateContainersLivenessProbe(original["livenessProbe"], d, config),
"startup_probe": flattenCloudRunV2ServiceTemplateContainersStartupProbe(original["startupProbe"], d, config),
"depends_on": flattenCloudRunV2ServiceTemplateContainersDependsOn(original["dependsOn"], d, config),
})
}
return transformed
}
func flattenCloudRunV2ServiceTemplateContainersName(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateContainersImage(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateContainersCommand(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateContainersArgs(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateContainersEnv(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return v
}
l := v.([]interface{})
transformed := schema.NewSet(schema.HashResource(cloudrunv2ServiceTemplateContainersContainersEnvSchema()), []interface{}{})
for _, raw := range l {
original := raw.(map[string]interface{})
if len(original) < 1 {
// Do not include empty json objects coming back from the api
continue
}
transformed.Add(map[string]interface{}{
"name": flattenCloudRunV2ServiceTemplateContainersEnvName(original["name"], d, config),
"value": flattenCloudRunV2ServiceTemplateContainersEnvValue(original["value"], d, config),
"value_source": flattenCloudRunV2ServiceTemplateContainersEnvValueSource(original["valueSource"], d, config),
})
}
return transformed
}
func flattenCloudRunV2ServiceTemplateContainersEnvName(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateContainersEnvValue(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateContainersEnvValueSource(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return nil
}
original := v.(map[string]interface{})
if len(original) == 0 {
return nil
}
transformed := make(map[string]interface{})
transformed["secret_key_ref"] =
flattenCloudRunV2ServiceTemplateContainersEnvValueSourceSecretKeyRef(original["secretKeyRef"], d, config)
return []interface{}{transformed}
}
func flattenCloudRunV2ServiceTemplateContainersEnvValueSourceSecretKeyRef(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return nil
}
original := v.(map[string]interface{})
if len(original) == 0 {
return nil
}
transformed := make(map[string]interface{})
transformed["secret"] =
flattenCloudRunV2ServiceTemplateContainersEnvValueSourceSecretKeyRefSecret(original["secret"], d, config)
transformed["version"] =
flattenCloudRunV2ServiceTemplateContainersEnvValueSourceSecretKeyRefVersion(original["version"], d, config)
return []interface{}{transformed}
}
func flattenCloudRunV2ServiceTemplateContainersEnvValueSourceSecretKeyRefSecret(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateContainersEnvValueSourceSecretKeyRefVersion(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateContainersResources(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return nil
}
original := v.(map[string]interface{})
if len(original) == 0 {
return nil
}
transformed := make(map[string]interface{})
transformed["limits"] =
flattenCloudRunV2ServiceTemplateContainersResourcesLimits(original["limits"], d, config)
transformed["cpu_idle"] =
flattenCloudRunV2ServiceTemplateContainersResourcesCpuIdle(original["cpuIdle"], d, config)
transformed["startup_cpu_boost"] =
flattenCloudRunV2ServiceTemplateContainersResourcesStartupCpuBoost(original["startupCpuBoost"], d, config)
return []interface{}{transformed}
}
func flattenCloudRunV2ServiceTemplateContainersResourcesLimits(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateContainersResourcesCpuIdle(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateContainersResourcesStartupCpuBoost(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateContainersPorts(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return v
}
l := v.([]interface{})
transformed := make([]interface{}, 0, len(l))
for _, raw := range l {
original := raw.(map[string]interface{})
if len(original) < 1 {
// Do not include empty json objects coming back from the api
continue
}
transformed = append(transformed, map[string]interface{}{
"name": flattenCloudRunV2ServiceTemplateContainersPortsName(original["name"], d, config),
"container_port": flattenCloudRunV2ServiceTemplateContainersPortsContainerPort(original["containerPort"], d, config),
})
}
return transformed
}
func flattenCloudRunV2ServiceTemplateContainersPortsName(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateContainersPortsContainerPort(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
// Handles the string fixed64 format
if strVal, ok := v.(string); ok {
if intVal, err := tpgresource.StringToFixed64(strVal); err == nil {
return intVal
}
}
// number values are represented as float64
if floatVal, ok := v.(float64); ok {
intVal := int(floatVal)
return intVal
}
return v // let terraform core handle it otherwise
}
func flattenCloudRunV2ServiceTemplateContainersVolumeMounts(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return v
}
l := v.([]interface{})
transformed := make([]interface{}, 0, len(l))
for _, raw := range l {
original := raw.(map[string]interface{})
if len(original) < 1 {
// Do not include empty json objects coming back from the api
continue
}
transformed = append(transformed, map[string]interface{}{
"name": flattenCloudRunV2ServiceTemplateContainersVolumeMountsName(original["name"], d, config),
"mount_path": flattenCloudRunV2ServiceTemplateContainersVolumeMountsMountPath(original["mountPath"], d, config),
})
}
return transformed
}
func flattenCloudRunV2ServiceTemplateContainersVolumeMountsName(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateContainersVolumeMountsMountPath(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateContainersWorkingDir(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateContainersLivenessProbe(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return nil
}
original := v.(map[string]interface{})
if len(original) == 0 {
return nil
}
transformed := make(map[string]interface{})
transformed["initial_delay_seconds"] =
flattenCloudRunV2ServiceTemplateContainersLivenessProbeInitialDelaySeconds(original["initialDelaySeconds"], d, config)
transformed["timeout_seconds"] =
flattenCloudRunV2ServiceTemplateContainersLivenessProbeTimeoutSeconds(original["timeoutSeconds"], d, config)
transformed["period_seconds"] =
flattenCloudRunV2ServiceTemplateContainersLivenessProbePeriodSeconds(original["periodSeconds"], d, config)
transformed["failure_threshold"] =
flattenCloudRunV2ServiceTemplateContainersLivenessProbeFailureThreshold(original["failureThreshold"], d, config)
transformed["http_get"] =
flattenCloudRunV2ServiceTemplateContainersLivenessProbeHttpGet(original["httpGet"], d, config)
transformed["grpc"] =
flattenCloudRunV2ServiceTemplateContainersLivenessProbeGrpc(original["grpc"], d, config)
transformed["tcp_socket"] =
flattenCloudRunV2ServiceTemplateContainersLivenessProbeTcpSocket(original["tcpSocket"], d, config)
return []interface{}{transformed}
}
func flattenCloudRunV2ServiceTemplateContainersLivenessProbeInitialDelaySeconds(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
// Handles the string fixed64 format
if strVal, ok := v.(string); ok {
if intVal, err := tpgresource.StringToFixed64(strVal); err == nil {
return intVal
}
}
// number values are represented as float64
if floatVal, ok := v.(float64); ok {
intVal := int(floatVal)
return intVal
}
return v // let terraform core handle it otherwise
}
func flattenCloudRunV2ServiceTemplateContainersLivenessProbeTimeoutSeconds(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
// Handles the string fixed64 format
if strVal, ok := v.(string); ok {
if intVal, err := tpgresource.StringToFixed64(strVal); err == nil {
return intVal
}
}
// number values are represented as float64
if floatVal, ok := v.(float64); ok {
intVal := int(floatVal)
return intVal
}
return v // let terraform core handle it otherwise
}
func flattenCloudRunV2ServiceTemplateContainersLivenessProbePeriodSeconds(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
// Handles the string fixed64 format
if strVal, ok := v.(string); ok {
if intVal, err := tpgresource.StringToFixed64(strVal); err == nil {
return intVal
}
}
// number values are represented as float64
if floatVal, ok := v.(float64); ok {
intVal := int(floatVal)
return intVal
}
return v // let terraform core handle it otherwise
}
func flattenCloudRunV2ServiceTemplateContainersLivenessProbeFailureThreshold(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
// Handles the string fixed64 format
if strVal, ok := v.(string); ok {
if intVal, err := tpgresource.StringToFixed64(strVal); err == nil {
return intVal
}
}
// number values are represented as float64
if floatVal, ok := v.(float64); ok {
intVal := int(floatVal)
return intVal
}
return v // let terraform core handle it otherwise
}
func flattenCloudRunV2ServiceTemplateContainersLivenessProbeHttpGet(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return nil
}
original := v.(map[string]interface{})
transformed := make(map[string]interface{})
transformed["path"] =
flattenCloudRunV2ServiceTemplateContainersLivenessProbeHttpGetPath(original["path"], d, config)
transformed["port"] =
flattenCloudRunV2ServiceTemplateContainersLivenessProbeHttpGetPort(original["port"], d, config)
transformed["http_headers"] =
flattenCloudRunV2ServiceTemplateContainersLivenessProbeHttpGetHttpHeaders(original["httpHeaders"], d, config)
return []interface{}{transformed}
}
func flattenCloudRunV2ServiceTemplateContainersLivenessProbeHttpGetPath(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateContainersLivenessProbeHttpGetPort(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
// Handles the string fixed64 format
if strVal, ok := v.(string); ok {
if intVal, err := tpgresource.StringToFixed64(strVal); err == nil {
return intVal
}
}
// number values are represented as float64
if floatVal, ok := v.(float64); ok {
intVal := int(floatVal)
return intVal
}
return v // let terraform core handle it otherwise
}
func flattenCloudRunV2ServiceTemplateContainersLivenessProbeHttpGetHttpHeaders(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return v
}
l := v.([]interface{})
transformed := make([]interface{}, 0, len(l))
for _, raw := range l {
original := raw.(map[string]interface{})
if len(original) < 1 {
// Do not include empty json objects coming back from the api
continue
}
transformed = append(transformed, map[string]interface{}{
"name": flattenCloudRunV2ServiceTemplateContainersLivenessProbeHttpGetHttpHeadersName(original["name"], d, config),
"value": flattenCloudRunV2ServiceTemplateContainersLivenessProbeHttpGetHttpHeadersValue(original["value"], d, config),
})
}
return transformed
}
func flattenCloudRunV2ServiceTemplateContainersLivenessProbeHttpGetHttpHeadersName(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateContainersLivenessProbeHttpGetHttpHeadersValue(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateContainersLivenessProbeGrpc(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return nil
}
original := v.(map[string]interface{})
transformed := make(map[string]interface{})
transformed["port"] =
flattenCloudRunV2ServiceTemplateContainersLivenessProbeGrpcPort(original["port"], d, config)
transformed["service"] =
flattenCloudRunV2ServiceTemplateContainersLivenessProbeGrpcService(original["service"], d, config)
return []interface{}{transformed}
}
func flattenCloudRunV2ServiceTemplateContainersLivenessProbeGrpcPort(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
// Handles the string fixed64 format
if strVal, ok := v.(string); ok {
if intVal, err := tpgresource.StringToFixed64(strVal); err == nil {
return intVal
}
}
// number values are represented as float64
if floatVal, ok := v.(float64); ok {
intVal := int(floatVal)
return intVal
}
return v // let terraform core handle it otherwise
}
func flattenCloudRunV2ServiceTemplateContainersLivenessProbeGrpcService(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateContainersLivenessProbeTcpSocket(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return nil
}
original := v.(map[string]interface{})
if len(original) == 0 {
return nil
}
transformed := make(map[string]interface{})
transformed["port"] =
flattenCloudRunV2ServiceTemplateContainersLivenessProbeTcpSocketPort(original["port"], d, config)
return []interface{}{transformed}
}
func flattenCloudRunV2ServiceTemplateContainersLivenessProbeTcpSocketPort(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
// Handles the string fixed64 format
if strVal, ok := v.(string); ok {
if intVal, err := tpgresource.StringToFixed64(strVal); err == nil {
return intVal
}
}
// number values are represented as float64
if floatVal, ok := v.(float64); ok {
intVal := int(floatVal)
return intVal
}
return v // let terraform core handle it otherwise
}
func flattenCloudRunV2ServiceTemplateContainersStartupProbe(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return nil
}
original := v.(map[string]interface{})
if len(original) == 0 {
return nil
}
transformed := make(map[string]interface{})
transformed["initial_delay_seconds"] =
flattenCloudRunV2ServiceTemplateContainersStartupProbeInitialDelaySeconds(original["initialDelaySeconds"], d, config)
transformed["timeout_seconds"] =
flattenCloudRunV2ServiceTemplateContainersStartupProbeTimeoutSeconds(original["timeoutSeconds"], d, config)
transformed["period_seconds"] =
flattenCloudRunV2ServiceTemplateContainersStartupProbePeriodSeconds(original["periodSeconds"], d, config)
transformed["failure_threshold"] =
flattenCloudRunV2ServiceTemplateContainersStartupProbeFailureThreshold(original["failureThreshold"], d, config)
transformed["http_get"] =
flattenCloudRunV2ServiceTemplateContainersStartupProbeHttpGet(original["httpGet"], d, config)
transformed["tcp_socket"] =
flattenCloudRunV2ServiceTemplateContainersStartupProbeTcpSocket(original["tcpSocket"], d, config)
transformed["grpc"] =
flattenCloudRunV2ServiceTemplateContainersStartupProbeGrpc(original["grpc"], d, config)
return []interface{}{transformed}
}
func flattenCloudRunV2ServiceTemplateContainersStartupProbeInitialDelaySeconds(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
// Handles the string fixed64 format
if strVal, ok := v.(string); ok {
if intVal, err := tpgresource.StringToFixed64(strVal); err == nil {
return intVal
}
}
// number values are represented as float64
if floatVal, ok := v.(float64); ok {
intVal := int(floatVal)
return intVal
}
return v // let terraform core handle it otherwise
}
func flattenCloudRunV2ServiceTemplateContainersStartupProbeTimeoutSeconds(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
// Handles the string fixed64 format
if strVal, ok := v.(string); ok {
if intVal, err := tpgresource.StringToFixed64(strVal); err == nil {
return intVal
}
}
// number values are represented as float64
if floatVal, ok := v.(float64); ok {
intVal := int(floatVal)
return intVal
}
return v // let terraform core handle it otherwise
}
func flattenCloudRunV2ServiceTemplateContainersStartupProbePeriodSeconds(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
// Handles the string fixed64 format
if strVal, ok := v.(string); ok {
if intVal, err := tpgresource.StringToFixed64(strVal); err == nil {
return intVal
}
}
// number values are represented as float64
if floatVal, ok := v.(float64); ok {
intVal := int(floatVal)
return intVal
}
return v // let terraform core handle it otherwise
}
func flattenCloudRunV2ServiceTemplateContainersStartupProbeFailureThreshold(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
// Handles the string fixed64 format
if strVal, ok := v.(string); ok {
if intVal, err := tpgresource.StringToFixed64(strVal); err == nil {
return intVal
}
}
// number values are represented as float64
if floatVal, ok := v.(float64); ok {
intVal := int(floatVal)
return intVal
}
return v // let terraform core handle it otherwise
}
func flattenCloudRunV2ServiceTemplateContainersStartupProbeHttpGet(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return nil
}
original := v.(map[string]interface{})
transformed := make(map[string]interface{})
transformed["path"] =
flattenCloudRunV2ServiceTemplateContainersStartupProbeHttpGetPath(original["path"], d, config)
transformed["port"] =
flattenCloudRunV2ServiceTemplateContainersStartupProbeHttpGetPort(original["port"], d, config)
transformed["http_headers"] =
flattenCloudRunV2ServiceTemplateContainersStartupProbeHttpGetHttpHeaders(original["httpHeaders"], d, config)
return []interface{}{transformed}
}
func flattenCloudRunV2ServiceTemplateContainersStartupProbeHttpGetPath(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateContainersStartupProbeHttpGetPort(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
// Handles the string fixed64 format
if strVal, ok := v.(string); ok {
if intVal, err := tpgresource.StringToFixed64(strVal); err == nil {
return intVal
}
}
// number values are represented as float64
if floatVal, ok := v.(float64); ok {
intVal := int(floatVal)
return intVal
}
return v // let terraform core handle it otherwise
}
func flattenCloudRunV2ServiceTemplateContainersStartupProbeHttpGetHttpHeaders(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return v
}
l := v.([]interface{})
transformed := make([]interface{}, 0, len(l))
for _, raw := range l {
original := raw.(map[string]interface{})
if len(original) < 1 {
// Do not include empty json objects coming back from the api
continue
}
transformed = append(transformed, map[string]interface{}{
"name": flattenCloudRunV2ServiceTemplateContainersStartupProbeHttpGetHttpHeadersName(original["name"], d, config),
"value": flattenCloudRunV2ServiceTemplateContainersStartupProbeHttpGetHttpHeadersValue(original["value"], d, config),
})
}
return transformed
}
func flattenCloudRunV2ServiceTemplateContainersStartupProbeHttpGetHttpHeadersName(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateContainersStartupProbeHttpGetHttpHeadersValue(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateContainersStartupProbeTcpSocket(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return nil
}
original := v.(map[string]interface{})
transformed := make(map[string]interface{})
transformed["port"] =
flattenCloudRunV2ServiceTemplateContainersStartupProbeTcpSocketPort(original["port"], d, config)
return []interface{}{transformed}
}
func flattenCloudRunV2ServiceTemplateContainersStartupProbeTcpSocketPort(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
// Handles the string fixed64 format
if strVal, ok := v.(string); ok {
if intVal, err := tpgresource.StringToFixed64(strVal); err == nil {
return intVal
}
}
// number values are represented as float64
if floatVal, ok := v.(float64); ok {
intVal := int(floatVal)
return intVal
}
return v // let terraform core handle it otherwise
}
func flattenCloudRunV2ServiceTemplateContainersStartupProbeGrpc(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return nil
}
original := v.(map[string]interface{})
transformed := make(map[string]interface{})
transformed["port"] =
flattenCloudRunV2ServiceTemplateContainersStartupProbeGrpcPort(original["port"], d, config)
transformed["service"] =
flattenCloudRunV2ServiceTemplateContainersStartupProbeGrpcService(original["service"], d, config)
return []interface{}{transformed}
}
func flattenCloudRunV2ServiceTemplateContainersStartupProbeGrpcPort(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
// Handles the string fixed64 format
if strVal, ok := v.(string); ok {
if intVal, err := tpgresource.StringToFixed64(strVal); err == nil {
return intVal
}
}
// number values are represented as float64
if floatVal, ok := v.(float64); ok {
intVal := int(floatVal)
return intVal
}
return v // let terraform core handle it otherwise
}
func flattenCloudRunV2ServiceTemplateContainersStartupProbeGrpcService(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateContainersDependsOn(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateVolumes(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return v
}
l := v.([]interface{})
transformed := make([]interface{}, 0, len(l))
for _, raw := range l {
original := raw.(map[string]interface{})
if len(original) < 1 {
// Do not include empty json objects coming back from the api
continue
}
transformed = append(transformed, map[string]interface{}{
"name": flattenCloudRunV2ServiceTemplateVolumesName(original["name"], d, config),
"secret": flattenCloudRunV2ServiceTemplateVolumesSecret(original["secret"], d, config),
"cloud_sql_instance": flattenCloudRunV2ServiceTemplateVolumesCloudSqlInstance(original["cloudSqlInstance"], d, config),
"empty_dir": flattenCloudRunV2ServiceTemplateVolumesEmptyDir(original["emptyDir"], d, config),
"gcs": flattenCloudRunV2ServiceTemplateVolumesGcs(original["gcs"], d, config),
"nfs": flattenCloudRunV2ServiceTemplateVolumesNfs(original["nfs"], d, config),
})
}
return transformed
}
func flattenCloudRunV2ServiceTemplateVolumesName(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateVolumesSecret(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return nil
}
original := v.(map[string]interface{})
if len(original) == 0 {
return nil
}
transformed := make(map[string]interface{})
transformed["secret"] =
flattenCloudRunV2ServiceTemplateVolumesSecretSecret(original["secret"], d, config)
transformed["default_mode"] =
flattenCloudRunV2ServiceTemplateVolumesSecretDefaultMode(original["defaultMode"], d, config)
transformed["items"] =
flattenCloudRunV2ServiceTemplateVolumesSecretItems(original["items"], d, config)
return []interface{}{transformed}
}
func flattenCloudRunV2ServiceTemplateVolumesSecretSecret(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateVolumesSecretDefaultMode(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
// Handles the string fixed64 format
if strVal, ok := v.(string); ok {
if intVal, err := tpgresource.StringToFixed64(strVal); err == nil {
return intVal
}
}
// number values are represented as float64
if floatVal, ok := v.(float64); ok {
intVal := int(floatVal)
return intVal
}
return v // let terraform core handle it otherwise
}
func flattenCloudRunV2ServiceTemplateVolumesSecretItems(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return v
}
l := v.([]interface{})
transformed := make([]interface{}, 0, len(l))
for _, raw := range l {
original := raw.(map[string]interface{})
if len(original) < 1 {
// Do not include empty json objects coming back from the api
continue
}
transformed = append(transformed, map[string]interface{}{
"path": flattenCloudRunV2ServiceTemplateVolumesSecretItemsPath(original["path"], d, config),
"version": flattenCloudRunV2ServiceTemplateVolumesSecretItemsVersion(original["version"], d, config),
"mode": flattenCloudRunV2ServiceTemplateVolumesSecretItemsMode(original["mode"], d, config),
})
}
return transformed
}
func flattenCloudRunV2ServiceTemplateVolumesSecretItemsPath(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateVolumesSecretItemsVersion(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateVolumesSecretItemsMode(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
// Handles the string fixed64 format
if strVal, ok := v.(string); ok {
if intVal, err := tpgresource.StringToFixed64(strVal); err == nil {
return intVal
}
}
// number values are represented as float64
if floatVal, ok := v.(float64); ok {
intVal := int(floatVal)
return intVal
}
return v // let terraform core handle it otherwise
}
func flattenCloudRunV2ServiceTemplateVolumesCloudSqlInstance(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return nil
}
original := v.(map[string]interface{})
if len(original) == 0 {
return nil
}
transformed := make(map[string]interface{})
transformed["instances"] =
flattenCloudRunV2ServiceTemplateVolumesCloudSqlInstanceInstances(original["instances"], d, config)
return []interface{}{transformed}
}
func flattenCloudRunV2ServiceTemplateVolumesCloudSqlInstanceInstances(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return v
}
return schema.NewSet(schema.HashString, v.([]interface{}))
}
func flattenCloudRunV2ServiceTemplateVolumesEmptyDir(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return nil
}
original := v.(map[string]interface{})
if len(original) == 0 {
return nil
}
transformed := make(map[string]interface{})
transformed["medium"] =
flattenCloudRunV2ServiceTemplateVolumesEmptyDirMedium(original["medium"], d, config)
transformed["size_limit"] =
flattenCloudRunV2ServiceTemplateVolumesEmptyDirSizeLimit(original["sizeLimit"], d, config)
return []interface{}{transformed}
}
func flattenCloudRunV2ServiceTemplateVolumesEmptyDirMedium(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateVolumesEmptyDirSizeLimit(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateVolumesGcs(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return nil
}
original := v.(map[string]interface{})
if len(original) == 0 {
return nil
}
transformed := make(map[string]interface{})
transformed["bucket"] =
flattenCloudRunV2ServiceTemplateVolumesGcsBucket(original["bucket"], d, config)
transformed["read_only"] =
flattenCloudRunV2ServiceTemplateVolumesGcsReadOnly(original["readOnly"], d, config)
return []interface{}{transformed}
}
func flattenCloudRunV2ServiceTemplateVolumesGcsBucket(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateVolumesGcsReadOnly(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateVolumesNfs(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return nil
}
original := v.(map[string]interface{})
if len(original) == 0 {
return nil
}
transformed := make(map[string]interface{})
transformed["server"] =
flattenCloudRunV2ServiceTemplateVolumesNfsServer(original["server"], d, config)
transformed["path"] =
flattenCloudRunV2ServiceTemplateVolumesNfsPath(original["path"], d, config)
transformed["read_only"] =
flattenCloudRunV2ServiceTemplateVolumesNfsReadOnly(original["readOnly"], d, config)
return []interface{}{transformed}
}
func flattenCloudRunV2ServiceTemplateVolumesNfsServer(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateVolumesNfsPath(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateVolumesNfsReadOnly(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateExecutionEnvironment(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateEncryptionKey(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateMaxInstanceRequestConcurrency(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
// Handles the string fixed64 format
if strVal, ok := v.(string); ok {
if intVal, err := tpgresource.StringToFixed64(strVal); err == nil {
return intVal
}
}
// number values are represented as float64
if floatVal, ok := v.(float64); ok {
intVal := int(floatVal)
return intVal
}
return v // let terraform core handle it otherwise
}
func flattenCloudRunV2ServiceTemplateSessionAffinity(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTemplateServiceMesh(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return nil
}
original := v.(map[string]interface{})
if len(original) == 0 {
return nil
}
transformed := make(map[string]interface{})
transformed["mesh"] =
flattenCloudRunV2ServiceTemplateServiceMeshMesh(original["mesh"], d, config)
return []interface{}{transformed}
}
func flattenCloudRunV2ServiceTemplateServiceMeshMesh(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTraffic(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return v
}
l := v.([]interface{})
transformed := make([]interface{}, 0, len(l))
for _, raw := range l {
original := raw.(map[string]interface{})
if len(original) < 1 {
// Do not include empty json objects coming back from the api
continue
}
transformed = append(transformed, map[string]interface{}{
"type": flattenCloudRunV2ServiceTrafficType(original["type"], d, config),
"revision": flattenCloudRunV2ServiceTrafficRevision(original["revision"], d, config),
"percent": flattenCloudRunV2ServiceTrafficPercent(original["percent"], d, config),
"tag": flattenCloudRunV2ServiceTrafficTag(original["tag"], d, config),
})
}
return transformed
}
func flattenCloudRunV2ServiceTrafficType(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTrafficRevision(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTrafficPercent(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
// Handles the string fixed64 format
if strVal, ok := v.(string); ok {
if intVal, err := tpgresource.StringToFixed64(strVal); err == nil {
return intVal
}
}
// number values are represented as float64
if floatVal, ok := v.(float64); ok {
intVal := int(floatVal)
return intVal
}
return v // let terraform core handle it otherwise
}
func flattenCloudRunV2ServiceTrafficTag(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceObservedGeneration(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTerminalCondition(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return nil
}
original := v.(map[string]interface{})
if len(original) == 0 {
return nil
}
transformed := make(map[string]interface{})
transformed["type"] =
flattenCloudRunV2ServiceTerminalConditionType(original["type"], d, config)
transformed["state"] =
flattenCloudRunV2ServiceTerminalConditionState(original["state"], d, config)
transformed["message"] =
flattenCloudRunV2ServiceTerminalConditionMessage(original["message"], d, config)
transformed["last_transition_time"] =
flattenCloudRunV2ServiceTerminalConditionLastTransitionTime(original["lastTransitionTime"], d, config)
transformed["severity"] =
flattenCloudRunV2ServiceTerminalConditionSeverity(original["severity"], d, config)
transformed["reason"] =
flattenCloudRunV2ServiceTerminalConditionReason(original["reason"], d, config)
transformed["revision_reason"] =
flattenCloudRunV2ServiceTerminalConditionRevisionReason(original["revisionReason"], d, config)
transformed["execution_reason"] =
flattenCloudRunV2ServiceTerminalConditionExecutionReason(original["executionReason"], d, config)
return []interface{}{transformed}
}
func flattenCloudRunV2ServiceTerminalConditionType(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTerminalConditionState(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTerminalConditionMessage(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTerminalConditionLastTransitionTime(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTerminalConditionSeverity(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTerminalConditionReason(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTerminalConditionRevisionReason(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTerminalConditionExecutionReason(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceConditions(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return v
}
l := v.([]interface{})
transformed := make([]interface{}, 0, len(l))
for _, raw := range l {
original := raw.(map[string]interface{})
if len(original) < 1 {
// Do not include empty json objects coming back from the api
continue
}
transformed = append(transformed, map[string]interface{}{
"type": flattenCloudRunV2ServiceConditionsType(original["type"], d, config),
"state": flattenCloudRunV2ServiceConditionsState(original["state"], d, config),
"message": flattenCloudRunV2ServiceConditionsMessage(original["message"], d, config),
"last_transition_time": flattenCloudRunV2ServiceConditionsLastTransitionTime(original["lastTransitionTime"], d, config),
"severity": flattenCloudRunV2ServiceConditionsSeverity(original["severity"], d, config),
"reason": flattenCloudRunV2ServiceConditionsReason(original["reason"], d, config),
"revision_reason": flattenCloudRunV2ServiceConditionsRevisionReason(original["revisionReason"], d, config),
"execution_reason": flattenCloudRunV2ServiceConditionsExecutionReason(original["executionReason"], d, config),
})
}
return transformed
}
func flattenCloudRunV2ServiceConditionsType(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceConditionsState(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceConditionsMessage(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceConditionsLastTransitionTime(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceConditionsSeverity(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceConditionsReason(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceConditionsRevisionReason(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceConditionsExecutionReason(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceLatestReadyRevision(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceLatestCreatedRevision(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTrafficStatuses(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return v
}
l := v.([]interface{})
transformed := make([]interface{}, 0, len(l))
for _, raw := range l {
original := raw.(map[string]interface{})
if len(original) < 1 {
// Do not include empty json objects coming back from the api
continue
}
transformed = append(transformed, map[string]interface{}{
"type": flattenCloudRunV2ServiceTrafficStatusesType(original["type"], d, config),
"revision": flattenCloudRunV2ServiceTrafficStatusesRevision(original["revision"], d, config),
"percent": flattenCloudRunV2ServiceTrafficStatusesPercent(original["percent"], d, config),
"tag": flattenCloudRunV2ServiceTrafficStatusesTag(original["tag"], d, config),
"uri": flattenCloudRunV2ServiceTrafficStatusesUri(original["uri"], d, config),
})
}
return transformed
}
func flattenCloudRunV2ServiceTrafficStatusesType(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTrafficStatusesRevision(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTrafficStatusesPercent(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
// Handles the string fixed64 format
if strVal, ok := v.(string); ok {
if intVal, err := tpgresource.StringToFixed64(strVal); err == nil {
return intVal
}
}
// number values are represented as float64
if floatVal, ok := v.(float64); ok {
intVal := int(floatVal)
return intVal
}
return v // let terraform core handle it otherwise
}
func flattenCloudRunV2ServiceTrafficStatusesTag(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTrafficStatusesUri(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceUri(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceReconciling(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceEtag(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceTerraformLabels(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return v
}
transformed := make(map[string]interface{})
if l, ok := d.GetOkExists("terraform_labels"); ok {
for k := range l.(map[string]interface{}) {
transformed[k] = v.(map[string]interface{})[k]
}
}
return transformed
}
func flattenCloudRunV2ServiceEffectiveLabels(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func flattenCloudRunV2ServiceEffectiveAnnotations(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
func expandCloudRunV2ServiceDescription(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceClient(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceClientVersion(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceIngress(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceLaunchStage(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceBinaryAuthorization(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
if len(l) == 0 || l[0] == nil {
return nil, nil
}
raw := l[0]
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})
transformedBreakglassJustification, err := expandCloudRunV2ServiceBinaryAuthorizationBreakglassJustification(original["breakglass_justification"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedBreakglassJustification); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["breakglassJustification"] = transformedBreakglassJustification
}
transformedUseDefault, err := expandCloudRunV2ServiceBinaryAuthorizationUseDefault(original["use_default"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedUseDefault); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["useDefault"] = transformedUseDefault
}
transformedPolicy, err := expandCloudRunV2ServiceBinaryAuthorizationPolicy(original["policy"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedPolicy); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["policy"] = transformedPolicy
}
return transformed, nil
}
func expandCloudRunV2ServiceBinaryAuthorizationBreakglassJustification(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceBinaryAuthorizationUseDefault(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceBinaryAuthorizationPolicy(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceCustomAudiences(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceScaling(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
if len(l) == 0 || l[0] == nil {
return nil, nil
}
raw := l[0]
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})
transformedMinInstanceCount, err := expandCloudRunV2ServiceScalingMinInstanceCount(original["min_instance_count"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedMinInstanceCount); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["minInstanceCount"] = transformedMinInstanceCount
}
return transformed, nil
}
func expandCloudRunV2ServiceScalingMinInstanceCount(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceDefaultUriDisabled(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplate(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
if len(l) == 0 || l[0] == nil {
return nil, nil
}
raw := l[0]
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})
transformedRevision, err := expandCloudRunV2ServiceTemplateRevision(original["revision"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedRevision); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["revision"] = transformedRevision
}
transformedLabels, err := expandCloudRunV2ServiceTemplateLabels(original["labels"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedLabels); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["labels"] = transformedLabels
}
transformedAnnotations, err := expandCloudRunV2ServiceTemplateAnnotations(original["annotations"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedAnnotations); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["annotations"] = transformedAnnotations
}
transformedScaling, err := expandCloudRunV2ServiceTemplateScaling(original["scaling"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedScaling); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["scaling"] = transformedScaling
}
transformedVpcAccess, err := expandCloudRunV2ServiceTemplateVpcAccess(original["vpc_access"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedVpcAccess); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["vpcAccess"] = transformedVpcAccess
}
transformedTimeout, err := expandCloudRunV2ServiceTemplateTimeout(original["timeout"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedTimeout); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["timeout"] = transformedTimeout
}
transformedServiceAccount, err := expandCloudRunV2ServiceTemplateServiceAccount(original["service_account"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedServiceAccount); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["serviceAccount"] = transformedServiceAccount
}
transformedContainers, err := expandCloudRunV2ServiceTemplateContainers(original["containers"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedContainers); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["containers"] = transformedContainers
}
transformedVolumes, err := expandCloudRunV2ServiceTemplateVolumes(original["volumes"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedVolumes); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["volumes"] = transformedVolumes
}
transformedExecutionEnvironment, err := expandCloudRunV2ServiceTemplateExecutionEnvironment(original["execution_environment"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedExecutionEnvironment); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["executionEnvironment"] = transformedExecutionEnvironment
}
transformedEncryptionKey, err := expandCloudRunV2ServiceTemplateEncryptionKey(original["encryption_key"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedEncryptionKey); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["encryptionKey"] = transformedEncryptionKey
}
transformedMaxInstanceRequestConcurrency, err := expandCloudRunV2ServiceTemplateMaxInstanceRequestConcurrency(original["max_instance_request_concurrency"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedMaxInstanceRequestConcurrency); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["maxInstanceRequestConcurrency"] = transformedMaxInstanceRequestConcurrency
}
transformedSessionAffinity, err := expandCloudRunV2ServiceTemplateSessionAffinity(original["session_affinity"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedSessionAffinity); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["sessionAffinity"] = transformedSessionAffinity
}
transformedServiceMesh, err := expandCloudRunV2ServiceTemplateServiceMesh(original["service_mesh"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedServiceMesh); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["serviceMesh"] = transformedServiceMesh
}
return transformed, nil
}
func expandCloudRunV2ServiceTemplateRevision(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateLabels(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (map[string]string, error) {
if v == nil {
return map[string]string{}, nil
}
m := make(map[string]string)
for k, val := range v.(map[string]interface{}) {
m[k] = val.(string)
}
return m, nil
}
func expandCloudRunV2ServiceTemplateAnnotations(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (map[string]string, error) {
if v == nil {
return map[string]string{}, nil
}
m := make(map[string]string)
for k, val := range v.(map[string]interface{}) {
m[k] = val.(string)
}
return m, nil
}
func expandCloudRunV2ServiceTemplateScaling(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
if len(l) == 0 || l[0] == nil {
return nil, nil
}
raw := l[0]
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})
transformedMinInstanceCount, err := expandCloudRunV2ServiceTemplateScalingMinInstanceCount(original["min_instance_count"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedMinInstanceCount); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["minInstanceCount"] = transformedMinInstanceCount
}
transformedMaxInstanceCount, err := expandCloudRunV2ServiceTemplateScalingMaxInstanceCount(original["max_instance_count"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedMaxInstanceCount); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["maxInstanceCount"] = transformedMaxInstanceCount
}
return transformed, nil
}
func expandCloudRunV2ServiceTemplateScalingMinInstanceCount(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateScalingMaxInstanceCount(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateVpcAccess(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
if len(l) == 0 || l[0] == nil {
return nil, nil
}
raw := l[0]
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})
transformedConnector, err := expandCloudRunV2ServiceTemplateVpcAccessConnector(original["connector"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedConnector); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["connector"] = transformedConnector
}
transformedEgress, err := expandCloudRunV2ServiceTemplateVpcAccessEgress(original["egress"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedEgress); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["egress"] = transformedEgress
}
transformedNetworkInterfaces, err := expandCloudRunV2ServiceTemplateVpcAccessNetworkInterfaces(original["network_interfaces"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedNetworkInterfaces); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["networkInterfaces"] = transformedNetworkInterfaces
}
return transformed, nil
}
func expandCloudRunV2ServiceTemplateVpcAccessConnector(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateVpcAccessEgress(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateVpcAccessNetworkInterfaces(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
req := make([]interface{}, 0, len(l))
for _, raw := range l {
if raw == nil {
continue
}
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})
transformedNetwork, err := expandCloudRunV2ServiceTemplateVpcAccessNetworkInterfacesNetwork(original["network"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedNetwork); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["network"] = transformedNetwork
}
transformedSubnetwork, err := expandCloudRunV2ServiceTemplateVpcAccessNetworkInterfacesSubnetwork(original["subnetwork"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedSubnetwork); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["subnetwork"] = transformedSubnetwork
}
transformedTags, err := expandCloudRunV2ServiceTemplateVpcAccessNetworkInterfacesTags(original["tags"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedTags); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["tags"] = transformedTags
}
req = append(req, transformed)
}
return req, nil
}
func expandCloudRunV2ServiceTemplateVpcAccessNetworkInterfacesNetwork(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateVpcAccessNetworkInterfacesSubnetwork(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateVpcAccessNetworkInterfacesTags(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateTimeout(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateServiceAccount(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateContainers(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
req := make([]interface{}, 0, len(l))
for _, raw := range l {
if raw == nil {
continue
}
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})
transformedName, err := expandCloudRunV2ServiceTemplateContainersName(original["name"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedName); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["name"] = transformedName
}
transformedImage, err := expandCloudRunV2ServiceTemplateContainersImage(original["image"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedImage); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["image"] = transformedImage
}
transformedCommand, err := expandCloudRunV2ServiceTemplateContainersCommand(original["command"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedCommand); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["command"] = transformedCommand
}
transformedArgs, err := expandCloudRunV2ServiceTemplateContainersArgs(original["args"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedArgs); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["args"] = transformedArgs
}
transformedEnv, err := expandCloudRunV2ServiceTemplateContainersEnv(original["env"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedEnv); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["env"] = transformedEnv
}
transformedResources, err := expandCloudRunV2ServiceTemplateContainersResources(original["resources"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedResources); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["resources"] = transformedResources
}
transformedPorts, err := expandCloudRunV2ServiceTemplateContainersPorts(original["ports"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedPorts); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["ports"] = transformedPorts
}
transformedVolumeMounts, err := expandCloudRunV2ServiceTemplateContainersVolumeMounts(original["volume_mounts"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedVolumeMounts); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["volumeMounts"] = transformedVolumeMounts
}
transformedWorkingDir, err := expandCloudRunV2ServiceTemplateContainersWorkingDir(original["working_dir"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedWorkingDir); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["workingDir"] = transformedWorkingDir
}
transformedLivenessProbe, err := expandCloudRunV2ServiceTemplateContainersLivenessProbe(original["liveness_probe"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedLivenessProbe); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["livenessProbe"] = transformedLivenessProbe
}
transformedStartupProbe, err := expandCloudRunV2ServiceTemplateContainersStartupProbe(original["startup_probe"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedStartupProbe); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["startupProbe"] = transformedStartupProbe
}
transformedDependsOn, err := expandCloudRunV2ServiceTemplateContainersDependsOn(original["depends_on"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedDependsOn); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["dependsOn"] = transformedDependsOn
}
req = append(req, transformed)
}
return req, nil
}
func expandCloudRunV2ServiceTemplateContainersName(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateContainersImage(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateContainersCommand(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateContainersArgs(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateContainersEnv(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
v = v.(*schema.Set).List()
l := v.([]interface{})
req := make([]interface{}, 0, len(l))
for _, raw := range l {
if raw == nil {
continue
}
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})
transformedName, err := expandCloudRunV2ServiceTemplateContainersEnvName(original["name"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedName); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["name"] = transformedName
}
transformedValue, err := expandCloudRunV2ServiceTemplateContainersEnvValue(original["value"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedValue); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["value"] = transformedValue
}
transformedValueSource, err := expandCloudRunV2ServiceTemplateContainersEnvValueSource(original["value_source"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedValueSource); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["valueSource"] = transformedValueSource
}
req = append(req, transformed)
}
return req, nil
}
func expandCloudRunV2ServiceTemplateContainersEnvName(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateContainersEnvValue(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateContainersEnvValueSource(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
if len(l) == 0 || l[0] == nil {
return nil, nil
}
raw := l[0]
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})
transformedSecretKeyRef, err := expandCloudRunV2ServiceTemplateContainersEnvValueSourceSecretKeyRef(original["secret_key_ref"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedSecretKeyRef); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["secretKeyRef"] = transformedSecretKeyRef
}
return transformed, nil
}
func expandCloudRunV2ServiceTemplateContainersEnvValueSourceSecretKeyRef(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
if len(l) == 0 || l[0] == nil {
return nil, nil
}
raw := l[0]
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})
transformedSecret, err := expandCloudRunV2ServiceTemplateContainersEnvValueSourceSecretKeyRefSecret(original["secret"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedSecret); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["secret"] = transformedSecret
}
transformedVersion, err := expandCloudRunV2ServiceTemplateContainersEnvValueSourceSecretKeyRefVersion(original["version"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedVersion); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["version"] = transformedVersion
}
return transformed, nil
}
func expandCloudRunV2ServiceTemplateContainersEnvValueSourceSecretKeyRefSecret(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateContainersEnvValueSourceSecretKeyRefVersion(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateContainersResources(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
if len(l) == 0 || l[0] == nil {
return nil, nil
}
raw := l[0]
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})
transformedLimits, err := expandCloudRunV2ServiceTemplateContainersResourcesLimits(original["limits"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedLimits); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["limits"] = transformedLimits
}
transformedCpuIdle, err := expandCloudRunV2ServiceTemplateContainersResourcesCpuIdle(original["cpu_idle"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedCpuIdle); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["cpuIdle"] = transformedCpuIdle
}
transformedStartupCpuBoost, err := expandCloudRunV2ServiceTemplateContainersResourcesStartupCpuBoost(original["startup_cpu_boost"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedStartupCpuBoost); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["startupCpuBoost"] = transformedStartupCpuBoost
}
return transformed, nil
}
func expandCloudRunV2ServiceTemplateContainersResourcesLimits(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (map[string]string, error) {
if v == nil {
return map[string]string{}, nil
}
m := make(map[string]string)
for k, val := range v.(map[string]interface{}) {
m[k] = val.(string)
}
return m, nil
}
func expandCloudRunV2ServiceTemplateContainersResourcesCpuIdle(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateContainersResourcesStartupCpuBoost(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateContainersPorts(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
req := make([]interface{}, 0, len(l))
for _, raw := range l {
if raw == nil {
continue
}
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})
transformedName, err := expandCloudRunV2ServiceTemplateContainersPortsName(original["name"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedName); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["name"] = transformedName
}
transformedContainerPort, err := expandCloudRunV2ServiceTemplateContainersPortsContainerPort(original["container_port"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedContainerPort); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["containerPort"] = transformedContainerPort
}
req = append(req, transformed)
}
return req, nil
}
func expandCloudRunV2ServiceTemplateContainersPortsName(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateContainersPortsContainerPort(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateContainersVolumeMounts(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
req := make([]interface{}, 0, len(l))
for _, raw := range l {
if raw == nil {
continue
}
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})
transformedName, err := expandCloudRunV2ServiceTemplateContainersVolumeMountsName(original["name"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedName); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["name"] = transformedName
}
transformedMountPath, err := expandCloudRunV2ServiceTemplateContainersVolumeMountsMountPath(original["mount_path"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedMountPath); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["mountPath"] = transformedMountPath
}
req = append(req, transformed)
}
return req, nil
}
func expandCloudRunV2ServiceTemplateContainersVolumeMountsName(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateContainersVolumeMountsMountPath(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateContainersWorkingDir(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateContainersLivenessProbe(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
if len(l) == 0 || l[0] == nil {
return nil, nil
}
raw := l[0]
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})
transformedInitialDelaySeconds, err := expandCloudRunV2ServiceTemplateContainersLivenessProbeInitialDelaySeconds(original["initial_delay_seconds"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedInitialDelaySeconds); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["initialDelaySeconds"] = transformedInitialDelaySeconds
}
transformedTimeoutSeconds, err := expandCloudRunV2ServiceTemplateContainersLivenessProbeTimeoutSeconds(original["timeout_seconds"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedTimeoutSeconds); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["timeoutSeconds"] = transformedTimeoutSeconds
}
transformedPeriodSeconds, err := expandCloudRunV2ServiceTemplateContainersLivenessProbePeriodSeconds(original["period_seconds"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedPeriodSeconds); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["periodSeconds"] = transformedPeriodSeconds
}
transformedFailureThreshold, err := expandCloudRunV2ServiceTemplateContainersLivenessProbeFailureThreshold(original["failure_threshold"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedFailureThreshold); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["failureThreshold"] = transformedFailureThreshold
}
transformedHttpGet, err := expandCloudRunV2ServiceTemplateContainersLivenessProbeHttpGet(original["http_get"], d, config)
if err != nil {
return nil, err
} else {
transformed["httpGet"] = transformedHttpGet
}
transformedGrpc, err := expandCloudRunV2ServiceTemplateContainersLivenessProbeGrpc(original["grpc"], d, config)
if err != nil {
return nil, err
} else {
transformed["grpc"] = transformedGrpc
}
transformedTcpSocket, err := expandCloudRunV2ServiceTemplateContainersLivenessProbeTcpSocket(original["tcp_socket"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedTcpSocket); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["tcpSocket"] = transformedTcpSocket
}
return transformed, nil
}
func expandCloudRunV2ServiceTemplateContainersLivenessProbeInitialDelaySeconds(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateContainersLivenessProbeTimeoutSeconds(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateContainersLivenessProbePeriodSeconds(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateContainersLivenessProbeFailureThreshold(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateContainersLivenessProbeHttpGet(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
if len(l) == 0 {
return nil, nil
}
if l[0] == nil {
transformed := make(map[string]interface{})
return transformed, nil
}
raw := l[0]
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})
transformedPath, err := expandCloudRunV2ServiceTemplateContainersLivenessProbeHttpGetPath(original["path"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedPath); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["path"] = transformedPath
}
transformedPort, err := expandCloudRunV2ServiceTemplateContainersLivenessProbeHttpGetPort(original["port"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedPort); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["port"] = transformedPort
}
transformedHttpHeaders, err := expandCloudRunV2ServiceTemplateContainersLivenessProbeHttpGetHttpHeaders(original["http_headers"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedHttpHeaders); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["httpHeaders"] = transformedHttpHeaders
}
return transformed, nil
}
func expandCloudRunV2ServiceTemplateContainersLivenessProbeHttpGetPath(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateContainersLivenessProbeHttpGetPort(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateContainersLivenessProbeHttpGetHttpHeaders(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
req := make([]interface{}, 0, len(l))
for _, raw := range l {
if raw == nil {
continue
}
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})
transformedName, err := expandCloudRunV2ServiceTemplateContainersLivenessProbeHttpGetHttpHeadersName(original["name"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedName); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["name"] = transformedName
}
transformedValue, err := expandCloudRunV2ServiceTemplateContainersLivenessProbeHttpGetHttpHeadersValue(original["value"], d, config)
if err != nil {
return nil, err
} else {
transformed["value"] = transformedValue
}
req = append(req, transformed)
}
return req, nil
}
func expandCloudRunV2ServiceTemplateContainersLivenessProbeHttpGetHttpHeadersName(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateContainersLivenessProbeHttpGetHttpHeadersValue(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateContainersLivenessProbeGrpc(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
if len(l) == 0 {
return nil, nil
}
if l[0] == nil {
transformed := make(map[string]interface{})
return transformed, nil
}
raw := l[0]
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})
transformedPort, err := expandCloudRunV2ServiceTemplateContainersLivenessProbeGrpcPort(original["port"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedPort); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["port"] = transformedPort
}
transformedService, err := expandCloudRunV2ServiceTemplateContainersLivenessProbeGrpcService(original["service"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedService); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["service"] = transformedService
}
return transformed, nil
}
func expandCloudRunV2ServiceTemplateContainersLivenessProbeGrpcPort(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateContainersLivenessProbeGrpcService(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateContainersLivenessProbeTcpSocket(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
if len(l) == 0 || l[0] == nil {
return nil, nil
}
raw := l[0]
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})
transformedPort, err := expandCloudRunV2ServiceTemplateContainersLivenessProbeTcpSocketPort(original["port"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedPort); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["port"] = transformedPort
}
return transformed, nil
}
func expandCloudRunV2ServiceTemplateContainersLivenessProbeTcpSocketPort(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateContainersStartupProbe(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
if len(l) == 0 || l[0] == nil {
return nil, nil
}
raw := l[0]
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})
transformedInitialDelaySeconds, err := expandCloudRunV2ServiceTemplateContainersStartupProbeInitialDelaySeconds(original["initial_delay_seconds"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedInitialDelaySeconds); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["initialDelaySeconds"] = transformedInitialDelaySeconds
}
transformedTimeoutSeconds, err := expandCloudRunV2ServiceTemplateContainersStartupProbeTimeoutSeconds(original["timeout_seconds"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedTimeoutSeconds); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["timeoutSeconds"] = transformedTimeoutSeconds
}
transformedPeriodSeconds, err := expandCloudRunV2ServiceTemplateContainersStartupProbePeriodSeconds(original["period_seconds"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedPeriodSeconds); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["periodSeconds"] = transformedPeriodSeconds
}
transformedFailureThreshold, err := expandCloudRunV2ServiceTemplateContainersStartupProbeFailureThreshold(original["failure_threshold"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedFailureThreshold); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["failureThreshold"] = transformedFailureThreshold
}
transformedHttpGet, err := expandCloudRunV2ServiceTemplateContainersStartupProbeHttpGet(original["http_get"], d, config)
if err != nil {
return nil, err
} else {
transformed["httpGet"] = transformedHttpGet
}
transformedTcpSocket, err := expandCloudRunV2ServiceTemplateContainersStartupProbeTcpSocket(original["tcp_socket"], d, config)
if err != nil {
return nil, err
} else {
transformed["tcpSocket"] = transformedTcpSocket
}
transformedGrpc, err := expandCloudRunV2ServiceTemplateContainersStartupProbeGrpc(original["grpc"], d, config)
if err != nil {
return nil, err
} else {
transformed["grpc"] = transformedGrpc
}
return transformed, nil
}
func expandCloudRunV2ServiceTemplateContainersStartupProbeInitialDelaySeconds(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateContainersStartupProbeTimeoutSeconds(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateContainersStartupProbePeriodSeconds(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateContainersStartupProbeFailureThreshold(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateContainersStartupProbeHttpGet(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
if len(l) == 0 {
return nil, nil
}
if l[0] == nil {
transformed := make(map[string]interface{})
return transformed, nil
}
raw := l[0]
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})
transformedPath, err := expandCloudRunV2ServiceTemplateContainersStartupProbeHttpGetPath(original["path"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedPath); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["path"] = transformedPath
}
transformedPort, err := expandCloudRunV2ServiceTemplateContainersStartupProbeHttpGetPort(original["port"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedPort); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["port"] = transformedPort
}
transformedHttpHeaders, err := expandCloudRunV2ServiceTemplateContainersStartupProbeHttpGetHttpHeaders(original["http_headers"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedHttpHeaders); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["httpHeaders"] = transformedHttpHeaders
}
return transformed, nil
}
func expandCloudRunV2ServiceTemplateContainersStartupProbeHttpGetPath(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateContainersStartupProbeHttpGetPort(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateContainersStartupProbeHttpGetHttpHeaders(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
req := make([]interface{}, 0, len(l))
for _, raw := range l {
if raw == nil {
continue
}
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})
transformedName, err := expandCloudRunV2ServiceTemplateContainersStartupProbeHttpGetHttpHeadersName(original["name"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedName); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["name"] = transformedName
}
transformedValue, err := expandCloudRunV2ServiceTemplateContainersStartupProbeHttpGetHttpHeadersValue(original["value"], d, config)
if err != nil {
return nil, err
} else {
transformed["value"] = transformedValue
}
req = append(req, transformed)
}
return req, nil
}
func expandCloudRunV2ServiceTemplateContainersStartupProbeHttpGetHttpHeadersName(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateContainersStartupProbeHttpGetHttpHeadersValue(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateContainersStartupProbeTcpSocket(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
if len(l) == 0 {
return nil, nil
}
if l[0] == nil {
transformed := make(map[string]interface{})
return transformed, nil
}
raw := l[0]
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})
transformedPort, err := expandCloudRunV2ServiceTemplateContainersStartupProbeTcpSocketPort(original["port"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedPort); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["port"] = transformedPort
}
return transformed, nil
}
func expandCloudRunV2ServiceTemplateContainersStartupProbeTcpSocketPort(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateContainersStartupProbeGrpc(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
if len(l) == 0 {
return nil, nil
}
if l[0] == nil {
transformed := make(map[string]interface{})
return transformed, nil
}
raw := l[0]
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})
transformedPort, err := expandCloudRunV2ServiceTemplateContainersStartupProbeGrpcPort(original["port"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedPort); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["port"] = transformedPort
}
transformedService, err := expandCloudRunV2ServiceTemplateContainersStartupProbeGrpcService(original["service"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedService); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["service"] = transformedService
}
return transformed, nil
}
func expandCloudRunV2ServiceTemplateContainersStartupProbeGrpcPort(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateContainersStartupProbeGrpcService(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateContainersDependsOn(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateVolumes(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
req := make([]interface{}, 0, len(l))
for _, raw := range l {
if raw == nil {
continue
}
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})
transformedName, err := expandCloudRunV2ServiceTemplateVolumesName(original["name"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedName); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["name"] = transformedName
}
transformedSecret, err := expandCloudRunV2ServiceTemplateVolumesSecret(original["secret"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedSecret); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["secret"] = transformedSecret
}
transformedCloudSqlInstance, err := expandCloudRunV2ServiceTemplateVolumesCloudSqlInstance(original["cloud_sql_instance"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedCloudSqlInstance); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["cloudSqlInstance"] = transformedCloudSqlInstance
}
transformedEmptyDir, err := expandCloudRunV2ServiceTemplateVolumesEmptyDir(original["empty_dir"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedEmptyDir); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["emptyDir"] = transformedEmptyDir
}
transformedGcs, err := expandCloudRunV2ServiceTemplateVolumesGcs(original["gcs"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedGcs); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["gcs"] = transformedGcs
}
transformedNfs, err := expandCloudRunV2ServiceTemplateVolumesNfs(original["nfs"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedNfs); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["nfs"] = transformedNfs
}
req = append(req, transformed)
}
return req, nil
}
func expandCloudRunV2ServiceTemplateVolumesName(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateVolumesSecret(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
if len(l) == 0 || l[0] == nil {
return nil, nil
}
raw := l[0]
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})
transformedSecret, err := expandCloudRunV2ServiceTemplateVolumesSecretSecret(original["secret"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedSecret); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["secret"] = transformedSecret
}
transformedDefaultMode, err := expandCloudRunV2ServiceTemplateVolumesSecretDefaultMode(original["default_mode"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedDefaultMode); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["defaultMode"] = transformedDefaultMode
}
transformedItems, err := expandCloudRunV2ServiceTemplateVolumesSecretItems(original["items"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedItems); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["items"] = transformedItems
}
return transformed, nil
}
func expandCloudRunV2ServiceTemplateVolumesSecretSecret(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateVolumesSecretDefaultMode(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateVolumesSecretItems(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
req := make([]interface{}, 0, len(l))
for _, raw := range l {
if raw == nil {
continue
}
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})
transformedPath, err := expandCloudRunV2ServiceTemplateVolumesSecretItemsPath(original["path"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedPath); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["path"] = transformedPath
}
transformedVersion, err := expandCloudRunV2ServiceTemplateVolumesSecretItemsVersion(original["version"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedVersion); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["version"] = transformedVersion
}
transformedMode, err := expandCloudRunV2ServiceTemplateVolumesSecretItemsMode(original["mode"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedMode); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["mode"] = transformedMode
}
req = append(req, transformed)
}
return req, nil
}
func expandCloudRunV2ServiceTemplateVolumesSecretItemsPath(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateVolumesSecretItemsVersion(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateVolumesSecretItemsMode(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateVolumesCloudSqlInstance(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
if len(l) == 0 || l[0] == nil {
return nil, nil
}
raw := l[0]
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})
transformedInstances, err := expandCloudRunV2ServiceTemplateVolumesCloudSqlInstanceInstances(original["instances"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedInstances); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["instances"] = transformedInstances
}
return transformed, nil
}
func expandCloudRunV2ServiceTemplateVolumesCloudSqlInstanceInstances(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
v = v.(*schema.Set).List()
return v, nil
}
func expandCloudRunV2ServiceTemplateVolumesEmptyDir(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
if len(l) == 0 || l[0] == nil {
return nil, nil
}
raw := l[0]
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})
transformedMedium, err := expandCloudRunV2ServiceTemplateVolumesEmptyDirMedium(original["medium"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedMedium); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["medium"] = transformedMedium
}
transformedSizeLimit, err := expandCloudRunV2ServiceTemplateVolumesEmptyDirSizeLimit(original["size_limit"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedSizeLimit); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["sizeLimit"] = transformedSizeLimit
}
return transformed, nil
}
func expandCloudRunV2ServiceTemplateVolumesEmptyDirMedium(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateVolumesEmptyDirSizeLimit(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateVolumesGcs(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
if len(l) == 0 || l[0] == nil {
return nil, nil
}
raw := l[0]
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})
transformedBucket, err := expandCloudRunV2ServiceTemplateVolumesGcsBucket(original["bucket"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedBucket); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["bucket"] = transformedBucket
}
transformedReadOnly, err := expandCloudRunV2ServiceTemplateVolumesGcsReadOnly(original["read_only"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedReadOnly); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["readOnly"] = transformedReadOnly
}
return transformed, nil
}
func expandCloudRunV2ServiceTemplateVolumesGcsBucket(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateVolumesGcsReadOnly(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateVolumesNfs(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
if len(l) == 0 || l[0] == nil {
return nil, nil
}
raw := l[0]
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})
transformedServer, err := expandCloudRunV2ServiceTemplateVolumesNfsServer(original["server"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedServer); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["server"] = transformedServer
}
transformedPath, err := expandCloudRunV2ServiceTemplateVolumesNfsPath(original["path"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedPath); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["path"] = transformedPath
}
transformedReadOnly, err := expandCloudRunV2ServiceTemplateVolumesNfsReadOnly(original["read_only"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedReadOnly); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["readOnly"] = transformedReadOnly
}
return transformed, nil
}
func expandCloudRunV2ServiceTemplateVolumesNfsServer(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateVolumesNfsPath(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateVolumesNfsReadOnly(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateExecutionEnvironment(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateEncryptionKey(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateMaxInstanceRequestConcurrency(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateSessionAffinity(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTemplateServiceMesh(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
if len(l) == 0 || l[0] == nil {
return nil, nil
}
raw := l[0]
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})
transformedMesh, err := expandCloudRunV2ServiceTemplateServiceMeshMesh(original["mesh"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedMesh); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["mesh"] = transformedMesh
}
return transformed, nil
}
func expandCloudRunV2ServiceTemplateServiceMeshMesh(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTraffic(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
req := make([]interface{}, 0, len(l))
for _, raw := range l {
if raw == nil {
continue
}
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})
transformedType, err := expandCloudRunV2ServiceTrafficType(original["type"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedType); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["type"] = transformedType
}
transformedRevision, err := expandCloudRunV2ServiceTrafficRevision(original["revision"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedRevision); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["revision"] = transformedRevision
}
transformedPercent, err := expandCloudRunV2ServiceTrafficPercent(original["percent"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedPercent); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["percent"] = transformedPercent
}
transformedTag, err := expandCloudRunV2ServiceTrafficTag(original["tag"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedTag); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["tag"] = transformedTag
}
req = append(req, transformed)
}
return req, nil
}
func expandCloudRunV2ServiceTrafficType(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTrafficRevision(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTrafficPercent(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceTrafficTag(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
func expandCloudRunV2ServiceEffectiveLabels(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (map[string]string, error) {
if v == nil {
return map[string]string{}, nil
}
m := make(map[string]string)
for k, val := range v.(map[string]interface{}) {
m[k] = val.(string)
}
return m, nil
}
func expandCloudRunV2ServiceEffectiveAnnotations(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (map[string]string, error) {
if v == nil {
return map[string]string{}, nil
}
m := make(map[string]string)
for k, val := range v.(map[string]interface{}) {
m[k] = val.(string)
}
return m, nil
}