Repository: GoogleCloudPlatform/terraform-validator
Pull request #502 (2022-02-02 17:55:13)

Add converter resource for cloudfunctions
https://github.com/GoogleCloudPlatform/terraform-validator/issues/289

- The converter content is auto generated first, and manually modified a bit at https_trigger_url attribute. 


<!--
Replace each [ ] with [X] to check it. Switch to the preview view to make it easier to click on links.
These steps will speed up the review process, and we appreciate you spending time on them before sending
your code to be reviewed.
-->
If this PR is for Terraform, I acknowledge that I have:

- [X] Searched through the [issue tracker](https://github.com/hashicorp/terraform-provider-google/issues) for an open issue that this either resolves or contributes to, commented on it to claim it, and written "fixes {url}" or "part of {url}" in this PR description. If there were no relevant open issues, I opened one and commented that I would like to work on it (not necessary for very small changes).
- [ ] [Generated Terraform](https://github.com/GoogleCloudPlatform/magic-modules#generating-downstream-tools), and ran `make test` and `make lint` to ensure it passes unit and linter tests.
- [ ] Ensured that all new fields I added that can be set by a user appear in at least one [example](https://github.com/GoogleCloudPlatform/magic-modules/tree/master/templates/terraform/examples) (for generated resources) or [third_party test](https://github.com/GoogleCloudPlatform/magic-modules/tree/master/third_party/terraform/tests) (for handwritten resources or update tests).
- [ ] [Ran](https://github.com/hashicorp/terraform-provider-google/blob/master/.github/CONTRIBUTING.md#tests) relevant acceptance tests (If the acceptance tests do not yet pass or you are unable to run them, please let your reviewer know).
- [X] Read the [Release Notes Guide](https://github.com/GoogleCloudPlatform/magic-modules/blob/master/.ci/RELEASE_NOTES_GUIDE.md) before writing my release note below.

<!-- AUTOCHANGELOG for Downstream PRs.

Please select one of the following "release-note:" headings:
    - release-note:enhancement
    - release-note:bug
    - release-note:note
    - release-note:new-resource
    - release-note:new-datasource
    - release-note:deprecation
    - release-note:breaking-change
    - release-note:none
    
Unless you choose release-note:none, please add a release note.

See .ci/RELEASE_NOTES_GUIDE.md for writing good release notes.

You can add more release note blocks if you want more than one CHANGELOG
entry for this PR.
-->
**Release Note Template for Downstream PRs (will be copied)**

```release-note:none

```

Derived from https://github.com/GoogleCloudPlatform/magic-modules/pull/5669


Patch:
diff --git a/converters/google/resources/cloudfunctions_cloud_function.go b/converters/google/resources/cloudfunctions_cloud_function.go
new file mode 100644
index 00000000..0b465cd7
--- /dev/null
+++ b/converters/google/resources/cloudfunctions_cloud_function.go
@@ -0,0 +1,274 @@
+package google
+
+import "reflect"
+
+const CloudFunctionsCloudFunctionAssetType string = "cloudfunctions.googleapis.com/CloudFunction"
+
+func resourceConverterCloudFunctionsCloudFunction() ResourceConverter {
+	return ResourceConverter{
+		AssetType: CloudFunctionsCloudFunctionAssetType,
+		Convert:   GetCloudFunctionsCloudFunctionCaiObject,
+	}
+}
+
+func GetCloudFunctionsCloudFunctionCaiObject(d TerraformResourceData, config *Config) ([]Asset, error) {
+	name, err := assetName(d, config, "//cloudfunctions.googleapis.com/projects/{{project}}/locations/{{region}}/functions/{{name}}")
+	if err != nil {
+		return []Asset{}, err
+	}
+	if obj, err := GetCloudFunctionsCloudFunctionApiObject(d, config); err == nil {
+		return []Asset{{
+			Name: name,
+			Type: CloudFunctionsCloudFunctionAssetType,
+			Resource: &AssetResource{
+				Version:              "v1",
+				DiscoveryDocumentURI: "https://www.googleapis.com/discovery/v1/apis/cloudfunctions/v1/rest",
+				DiscoveryName:        "CloudFunction",
+				Data:                 obj,
+			},
+		}}, nil
+	} else {
+		return []Asset{}, err
+	}
+}
+
+func GetCloudFunctionsCloudFunctionApiObject(d TerraformResourceData, config *Config) (map[string]interface{}, error) {
+	obj := make(map[string]interface{})
+	nameProp, err := expandCloudFunctionsCloudFunctionName(d.Get("name"), d, config)
+	if err != nil {
+		return nil, err
+	} else if v, ok := d.GetOkExists("name"); !isEmptyValue(reflect.ValueOf(nameProp)) && (ok || !reflect.DeepEqual(v, nameProp)) {
+		obj["name"] = nameProp
+	}
+	descriptionProp, err := expandCloudFunctionsCloudFunctionDescription(d.Get("description"), d, config)
+	if err != nil {
+		return nil, err
+	} else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(descriptionProp)) && (ok || !reflect.DeepEqual(v, descriptionProp)) {
+		obj["description"] = descriptionProp
+	}
+	entryPointProp, err := expandCloudFunctionsCloudFunctionEntryPoint(d.Get("entry_point"), d, config)
+	if err != nil {
+		return nil, err
+	} else if v, ok := d.GetOkExists("entry_point"); !isEmptyValue(reflect.ValueOf(entryPointProp)) && (ok || !reflect.DeepEqual(v, entryPointProp)) {
+		obj["entryPoint"] = entryPointProp
+	}
+	runtimeProp, err := expandCloudFunctionsCloudFunctionRuntime(d.Get("runtime"), d, config)
+	if err != nil {
+		return nil, err
+	} else if v, ok := d.GetOkExists("runtime"); !isEmptyValue(reflect.ValueOf(runtimeProp)) && (ok || !reflect.DeepEqual(v, runtimeProp)) {
+		obj["runtime"] = runtimeProp
+	}
+	timeoutProp, err := expandCloudFunctionsCloudFunctionTimeout(d.Get("timeout"), d, config)
+	if err != nil {
+		return nil, err
+	} else if v, ok := d.GetOkExists("timeout"); !isEmptyValue(reflect.ValueOf(timeoutProp)) && (ok || !reflect.DeepEqual(v, timeoutProp)) {
+		obj["timeout"] = timeoutProp
+	}
+	availableMemoryMbProp, err := expandCloudFunctionsCloudFunctionAvailableMemoryMb(d.Get("available_memory_mb"), d, config)
+	if err != nil {
+		return nil, err
+	} else if v, ok := d.GetOkExists("available_memory_mb"); !isEmptyValue(reflect.ValueOf(availableMemoryMbProp)) && (ok || !reflect.DeepEqual(v, availableMemoryMbProp)) {
+		obj["availableMemoryMb"] = availableMemoryMbProp
+	}
+	labelsProp, err := expandCloudFunctionsCloudFunctionLabels(d.Get("labels"), d, config)
+	if err != nil {
+		return nil, err
+	} else if v, ok := d.GetOkExists("labels"); !isEmptyValue(reflect.ValueOf(labelsProp)) && (ok || !reflect.DeepEqual(v, labelsProp)) {
+		obj["labels"] = labelsProp
+	}
+	environmentVariablesProp, err := expandCloudFunctionsCloudFunctionEnvironmentVariables(d.Get("environment_variables"), d, config)
+	if err != nil {
+		return nil, err
+	} else if v, ok := d.GetOkExists("environment_variables"); !isEmptyValue(reflect.ValueOf(environmentVariablesProp)) && (ok || !reflect.DeepEqual(v, environmentVariablesProp)) {
+		obj["environmentVariables"] = environmentVariablesProp
+	}
+	sourceArchiveUrlProp, err := expandCloudFunctionsCloudFunctionSourceArchiveUrl(d.Get("source_archive_url"), d, config)
+	if err != nil {
+		return nil, err
+	} else if v, ok := d.GetOkExists("source_archive_url"); !isEmptyValue(reflect.ValueOf(sourceArchiveUrlProp)) && (ok || !reflect.DeepEqual(v, sourceArchiveUrlProp)) {
+		obj["sourceArchiveUrl"] = sourceArchiveUrlProp
+	}
+	sourceUploadUrlProp, err := expandCloudFunctionsCloudFunctionSourceUploadUrl(d.Get("source_upload_url"), d, config)
+	if err != nil {
+		return nil, err
+	} else if v, ok := d.GetOkExists("source_upload_url"); !isEmptyValue(reflect.ValueOf(sourceUploadUrlProp)) && (ok || !reflect.DeepEqual(v, sourceUploadUrlProp)) {
+		obj["sourceUploadUrl"] = sourceUploadUrlProp
+	}
+	sourceRepositoryProp, err := expandCloudFunctionsCloudFunctionSourceRepository(d.Get("source_repository"), d, config)
+	if err != nil {
+		return nil, err
+	} else if v, ok := d.GetOkExists("source_repository"); !isEmptyValue(reflect.ValueOf(sourceRepositoryProp)) && (ok || !reflect.DeepEqual(v, sourceRepositoryProp)) {
+		obj["sourceRepository"] = sourceRepositoryProp
+	}
+	httpsTriggerProp, err := expandCloudFunctionsCloudFunctionHttpsTriggerUrl(d.Get("https_trigger_url"), d, config)
+	if err != nil {
+		return nil, err
+	} else if v, ok := d.GetOkExists("https_trigger_url"); !isEmptyValue(reflect.ValueOf(httpsTriggerProp)) && (ok || !reflect.DeepEqual(v, httpsTriggerProp)) {
+		obj["httpsTriggerUrl"] = httpsTriggerProp
+	}
+	eventTriggerProp, err := expandCloudFunctionsCloudFunctionEventTrigger(d.Get("event_trigger"), d, config)
+	if err != nil {
+		return nil, err
+	} else if v, ok := d.GetOkExists("event_trigger"); !isEmptyValue(reflect.ValueOf(eventTriggerProp)) && (ok || !reflect.DeepEqual(v, eventTriggerProp)) {
+		obj["eventTrigger"] = eventTriggerProp
+	}
+	locationProp, err := expandCloudFunctionsCloudFunctionRegion(d.Get("region"), d, config)
+	if err != nil {
+		return nil, err
+	} else if v, ok := d.GetOkExists("region"); !isEmptyValue(reflect.ValueOf(locationProp)) && (ok || !reflect.DeepEqual(v, locationProp)) {
+		obj["location"] = locationProp
+	}
+	trigger_httpProp, err := expandCloudFunctionsCloudFunctionTriggerHttp(d.Get("trigger_http"), d, config)
+	if err != nil {
+		return nil, err
+	} else if v, ok := d.GetOkExists("trigger_http"); !isEmptyValue(reflect.ValueOf(trigger_httpProp)) && (ok || !reflect.DeepEqual(v, trigger_httpProp)) {
+		obj["trigger_http"] = trigger_httpProp
+	}
+
+	return obj, nil
+}
+
+func expandCloudFunctionsCloudFunctionName(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
+	return v, nil
+}
+
+func expandCloudFunctionsCloudFunctionDescription(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
+	return v, nil
+}
+
+func expandCloudFunctionsCloudFunctionEntryPoint(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
+	return v, nil
+}
+
+func expandCloudFunctionsCloudFunctionRuntime(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
+	return v, nil
+}
+
+func expandCloudFunctionsCloudFunctionTimeout(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
+	return v, nil
+}
+
+func expandCloudFunctionsCloudFunctionAvailableMemoryMb(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
+	return v, nil
+}
+
+func expandCloudFunctionsCloudFunctionLabels(v interface{}, d TerraformResourceData, config *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 expandCloudFunctionsCloudFunctionEnvironmentVariables(v interface{}, d TerraformResourceData, config *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 expandCloudFunctionsCloudFunctionSourceArchiveUrl(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
+	return v, nil
+}
+
+func expandCloudFunctionsCloudFunctionSourceUploadUrl(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
+	return v, nil
+}
+
+func expandCloudFunctionsCloudFunctionSourceRepository(v interface{}, d TerraformResourceData, config *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{})
+
+	transformedUrl, err := expandCloudFunctionsCloudFunctionSourceRepositoryUrl(original["url"], d, config)
+	if err != nil {
+		return nil, err
+	} else if val := reflect.ValueOf(transformedUrl); val.IsValid() && !isEmptyValue(val) {
+		transformed["url"] = transformedUrl
+	}
+
+	transformedDeployedUrl, err := expandCloudFunctionsCloudFunctionSourceRepositoryDeployedUrl(original["deployed_url"], d, config)
+	if err != nil {
+		return nil, err
+	} else if val := reflect.ValueOf(transformedDeployedUrl); val.IsValid() && !isEmptyValue(val) {
+		transformed["deployedUrl"] = transformedDeployedUrl
+	}
+
+	return transformed, nil
+}
+
+func expandCloudFunctionsCloudFunctionSourceRepositoryUrl(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
+	return v, nil
+}
+
+func expandCloudFunctionsCloudFunctionSourceRepositoryDeployedUrl(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
+	return v, nil
+}
+
+func expandCloudFunctionsCloudFunctionHttpsTriggerUrl(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
+	return v, nil
+}
+
+func expandCloudFunctionsCloudFunctionEventTrigger(v interface{}, d TerraformResourceData, config *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{})
+
+	transformedEventType, err := expandCloudFunctionsCloudFunctionEventTriggerEventType(original["event_type"], d, config)
+	if err != nil {
+		return nil, err
+	} else if val := reflect.ValueOf(transformedEventType); val.IsValid() && !isEmptyValue(val) {
+		transformed["eventType"] = transformedEventType
+	}
+
+	transformedResource, err := expandCloudFunctionsCloudFunctionEventTriggerResource(original["resource"], d, config)
+	if err != nil {
+		return nil, err
+	} else if val := reflect.ValueOf(transformedResource); val.IsValid() && !isEmptyValue(val) {
+		transformed["resource"] = transformedResource
+	}
+
+	transformedService, err := expandCloudFunctionsCloudFunctionEventTriggerService(original["service"], d, config)
+	if err != nil {
+		return nil, err
+	} else if val := reflect.ValueOf(transformedService); val.IsValid() && !isEmptyValue(val) {
+		transformed["service"] = transformedService
+	}
+
+	return transformed, nil
+}
+
+func expandCloudFunctionsCloudFunctionEventTriggerEventType(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
+	return v, nil
+}
+
+func expandCloudFunctionsCloudFunctionEventTriggerResource(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
+	return v, nil
+}
+
+func expandCloudFunctionsCloudFunctionEventTriggerService(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
+	return v, nil
+}
+
+func expandCloudFunctionsCloudFunctionRegion(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
+	return v, nil
+}
+
+func expandCloudFunctionsCloudFunctionTriggerHttp(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
+	return v, nil
+}
diff --git a/converters/google/resources/resource_converters.go b/converters/google/resources/resource_converters.go
index 785e36f1..66b455d6 100644
--- a/converters/google/resources/resource_converters.go
+++ b/converters/google/resources/resource_converters.go
@@ -74,6 +74,7 @@ func ResourceConverters() map[string][]ResourceConverter {
 		"google_access_context_manager_service_perimeter":  {resourceConverterAccessContextManagerServicePerimeter()},
 		"google_cloud_run_service":                         {resourceConverterCloudRunService()},
 		"google_cloud_run_domain_mapping":                  {resourceConverterCloudRunDomainMapping()},
+		"google_cloudfunctions_function":                   {resourceConverterCloudFunctionsCloudFunction()},
 		"google_monitoring_notification_channel":           {resourceConverterMonitoringNotificationChannel()},
 		"google_monitoring_alert_policy":                   {resourceConverterMonitoringAlertPolicy()},
 		"google_apigee_environment_iam_policy":             {resourceConverterApigeeEnvironmentIamPolicy()},


Test patch:
diff --git a/test/cli_test.go b/test/cli_test.go
index 88ead084..f3b7f3ca 100644
--- a/test/cli_test.go
+++ b/test/cli_test.go
@@ -92,6 +92,7 @@ func TestCLI(t *testing.T) {
 		{name: "example_dns_managed_zone"},
 		{name: "example_dns_policy"},
 		{name: "example_filestore_instance"},
+		{name: "example_google_cloudfunctions_function"},
 		{name: "example_kms_crypto_key"},
 		{name: "example_kms_crypto_key_iam_binding"},
 		{name: "example_kms_crypto_key_iam_member"},
diff --git a/test/read_test.go b/test/read_test.go
index 1678b694..bb995fbb 100644
--- a/test/read_test.go
+++ b/test/read_test.go
@@ -56,6 +56,7 @@ func TestReadPlannedAssetsCoverage(t *testing.T) {
 		{name: "example_dns_managed_zone"},
 		{name: "example_dns_policy"},
 		{name: "example_filestore_instance"},
+		{name: "example_google_cloudfunctions_function"},
 		{name: "example_kms_crypto_key"},
 		{name: "example_kms_crypto_key_iam_binding"},
 		{name: "example_kms_crypto_key_iam_member"},
diff --git a/testdata/templates/example_google_cloudfunctions_function.json b/testdata/templates/example_google_cloudfunctions_function.json
new file mode 100644
index 00000000..4cbebd01
--- /dev/null
+++ b/testdata/templates/example_google_cloudfunctions_function.json
@@ -0,0 +1,29 @@
+[
+  {
+    "name": "//cloudfunctions.googleapis.com/projects/{{.Provider.project}}/locations/australia-southeast1/functions/function-test",
+    "asset_type": "cloudfunctions.googleapis.com/CloudFunction",
+    "ancestry_path": "{{.Ancestry}}/project/{{.Provider.project}}",
+    "resource": {
+      "version": "v1",
+      "discovery_document_uri": "https://www.googleapis.com/discovery/v1/apis/cloudfunctions/v1/rest",
+      "discovery_name": "CloudFunction",
+      "parent": "//cloudresourcemanager.googleapis.com/projects/{{.Provider.project}}",
+      "data": {
+        "availableMemoryMb": 128,
+        "description": "My function",
+        "entryPoint": "helloGCS",
+        "environmentVariables": {
+          "MY_ENV_VAR": "my-env-var-value"
+        },
+        "labels": {
+          "my-label": "my-label-value"
+        },
+        "location": "australia-southeast1",
+        "name": "function-test",
+        "runtime": "nodejs14",
+        "timeout": 60,
+        "trigger_http": true
+      }
+    }
+  }
+]
diff --git a/testdata/templates/example_google_cloudfunctions_function.tf b/testdata/templates/example_google_cloudfunctions_function.tf
new file mode 100644
index 00000000..b0ebfacd
--- /dev/null
+++ b/testdata/templates/example_google_cloudfunctions_function.tf
@@ -0,0 +1,50 @@
+/**
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+terraform {
+  required_providers {
+    google = {
+      source = "hashicorp/google"
+      version = "~> {{.Provider.version}}"
+    }
+  }
+}
+
+provider "google" {
+  {{if .Provider.credentials }}credentials = "{{.Provider.credentials}}"{{end}}
+}
+
+resource "google_cloudfunctions_function" "function" {
+  name        = "function-test"
+  description = "My function"
+  runtime     = "nodejs14"
+
+  available_memory_mb   = 128
+  source_archive_bucket = "validator_bucket_local"
+  source_archive_object = "sample.zip"
+  trigger_http          = true
+  timeout               = 60
+  entry_point           = "helloGCS"
+  labels = {
+    my-label = "my-label-value"
+  }
+
+  environment_variables = {
+    MY_ENV_VAR = "my-env-var-value"
+  }
+
+  region = "australia-southeast1"
+}
diff --git a/testdata/templates/example_google_cloudfunctions_function.tfplan.json b/testdata/templates/example_google_cloudfunctions_function.tfplan.json
new file mode 100644
index 00000000..5b726ccb
--- /dev/null
+++ b/testdata/templates/example_google_cloudfunctions_function.tfplan.json
@@ -0,0 +1,163 @@
+{
+  "format_version": "0.2",
+  "terraform_version": "1.0.10",
+  "planned_values": {
+    "root_module": {
+      "resources": [
+        {
+          "address": "google_cloudfunctions_function.function",
+          "mode": "managed",
+          "type": "google_cloudfunctions_function",
+          "name": "function",
+          "provider_name": "registry.terraform.io/hashicorp/google",
+          "schema_version": 0,
+          "values": {
+            "available_memory_mb": 128,
+            "build_environment_variables": null,
+            "description": "My function",
+            "entry_point": "helloGCS",
+            "environment_variables": {
+              "MY_ENV_VAR": "my-env-var-value"
+            },
+            "ingress_settings": "ALLOW_ALL",
+            "labels": {
+              "my-label": "my-label-value"
+            },
+            "max_instances": 0,
+            "min_instances": null,
+            "name": "function-test",
+            "region": "australia-southeast1",
+            "runtime": "nodejs14",
+            "source_archive_bucket": "validator_bucket_local",
+            "source_archive_object": "sample.zip",
+            "source_repository": [],
+            "timeout": 60,
+            "timeouts": null,
+            "trigger_http": true,
+            "vpc_connector": null
+          },
+          "sensitive_values": {
+            "environment_variables": {},
+            "event_trigger": [],
+            "labels": {},
+            "source_repository": []
+          }
+        }
+      ]
+    }
+  },
+  "resource_changes": [
+    {
+      "address": "google_cloudfunctions_function.function",
+      "mode": "managed",
+      "type": "google_cloudfunctions_function",
+      "name": "function",
+      "provider_name": "registry.terraform.io/hashicorp/google",
+      "change": {
+        "actions": [
+          "create"
+        ],
+        "before": null,
+        "after": {
+          "available_memory_mb": 128,
+          "build_environment_variables": null,
+          "description": "My function",
+          "entry_point": "helloGCS",
+          "environment_variables": {
+            "MY_ENV_VAR": "my-env-var-value"
+          },
+          "ingress_settings": "ALLOW_ALL",
+          "labels": {
+            "my-label": "my-label-value"
+          },
+          "max_instances": 0,
+          "min_instances": null,
+          "name": "function-test",
+          "region": "australia-southeast1",
+          "runtime": "nodejs14",
+          "source_archive_bucket": "validator_bucket_local",
+          "source_archive_object": "sample.zip",
+          "source_repository": [],
+          "timeout": 60,
+          "timeouts": null,
+          "trigger_http": true,
+          "vpc_connector": null
+        },
+        "after_unknown": {
+          "environment_variables": {},
+          "event_trigger": true,
+          "https_trigger_url": true,
+          "id": true,
+          "labels": {},
+          "project": true,
+          "service_account_email": true,
+          "source_repository": [],
+          "vpc_connector_egress_settings": true
+        },
+        "before_sensitive": false,
+        "after_sensitive": {
+          "environment_variables": {},
+          "event_trigger": [],
+          "labels": {},
+          "source_repository": []
+        }
+      }
+    }
+  ],
+  "configuration": {
+    "root_module": {
+      "resources": [
+        {
+          "address": "google_cloudfunctions_function.function",
+          "mode": "managed",
+          "type": "google_cloudfunctions_function",
+          "name": "function",
+          "provider_config_key": "google",
+          "expressions": {
+            "available_memory_mb": {
+              "constant_value": 128
+            },
+            "description": {
+              "constant_value": "My function"
+            },
+            "entry_point": {
+              "constant_value": "helloGCS"
+            },
+            "environment_variables": {
+              "constant_value": {
+                "MY_ENV_VAR": "my-env-var-value"
+              }
+            },
+            "labels": {
+              "constant_value": {
+                "my-label": "my-label-value"
+              }
+            },
+            "name": {
+              "constant_value": "function-test"
+            },
+            "region": {
+              "constant_value": "australia-southeast1"
+            },
+            "runtime": {
+              "constant_value": "nodejs14"
+            },
+            "source_archive_bucket": {
+              "constant_value": "validator_bucket_local"
+            },
+            "source_archive_object": {
+              "constant_value": "sample.zip"
+            },
+            "timeout": {
+              "constant_value": 60
+            },
+            "trigger_http": {
+              "constant_value": true
+            }
+          },
+          "schema_version": 0
+        }
+      ]
+    }
+  }
+}