Project: Chef InSpec (Provisioning / Security & Compliance)
File: google_cloudfunctions_cloud_function.md

+++ title = "googlecloudfunctionscloud_function resource" draft = false gh_repo = "inspec" platform = "gcp" [menu] [menu.inspec] title = "googlecloudfunctionscloud_function" identifier = "inspec/resources/gcp/googlecloudfunctionscloudfunction.md googlecloudfunctionscloudfunction resource" parent = "inspec/resources/gcp" +++ A `googlecloudfunctionscloud_function` is used to test a Google CloudFunction resource ```ruby describe googlecloudfunctionscloud_function(project: 'chef-gcp-inspec', location: 'europe-west1', name: 'inspec-gcp-function') do it { should exist } its('description') { should eq 'A description of the function' } its('availablememorymb') { should eq '128' } its('https_trigger.url') { should match /\/inspec-gcp-function$/ } its('entry_point') { should eq 'hello' } its('environmentvariables') { should include('MYENV_VAR' => 'val1') } end describe googlecloudfunctionscloud_function(project: 'chef-gcp-inspec', location: 'europe-west1', name: 'nonexistent') do it { should_not exist } end ``` Properties that can be accessed from the `googlecloudfunctionscloud_function` resource: `name` : A user-defined name of the function. Function names must be unique globally and match pattern `projects//locations//functions/*`. `description` : User-provided description of a function. `status` : Status of the function deployment. Possible values: CLOUDFUNCTIONSTATUS_UNSPECIFIED ACTIVE OFFLINE DEPLOYINPROGRESS DELETEINPROGRESS UNKNOWN `entry_point` : The name of the function (as defined in source code) that will be executed. Defaults to the resource name suffix, if not specified. For backward compatibility, if function with given name is not found, then the system will try to use function named "function". For Node.js this is name of a function exported by the module specified in source_location. `runtime` : The runtime in which the function is going to run. If empty, defaults to Node.js 6. `timeout` : The function execution timeout. Execution is considered failed and can be terminated if the function is not completed at the end of the timeout period. Defaults to 60 seconds. `availablememorymb` : The amount of memory in MB available for a function. `serviceaccountemail` : The email of the service account for this function. `update_time` : The last update timestamp of a Cloud Function `version_id` : The version identifier of the Cloud Function. Each deployment attempt results in a new version of a function being created. `labels` : A set of key/value label pairs associated with this Cloud Function. `environment_variables` : Environment variables that shall be available during function execution. `sourcearchiveurl` : The Google Cloud Storage URL, starting with gs://, pointing to the zip archive which contains the function. `sourceuploadurl` : The Google Cloud Storage signed URL used for source uploading. `source_repository` : The source repository where a function is hosted. `url` : The URL pointing to the hosted repository where the function is defined `deployed_url` : The URL pointing to the hosted repository where the function were defined at the time of deployment. `https_trigger` : An HTTPS endpoint type of source that can be triggered via URL. `url` : The deployed url for the function. `event_trigger` : An HTTPS endpoint type of source that can be triggered via URL. `event_type` : The type of event to observe. For example: `providers/cloud.storage/eventTypes/object.change` and `providers/cloud.pubsub/eventTypes/topic.publish`. `resource` : The resource(s) from which to observe events, for example, `projects/_/buckets/myBucket.` `service` : The hostname of the service that should be observed. `location` : The location of this cloud function. Ensure the is enabled for the current project.