mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-10-04 17:51:11 +00:00
Add support for google_cloudfunctions_function runtime (#2340)
<!-- This change is generated by MagicModules. --> /cc @rileykarson
This commit is contained in:
parent
04e25671f9
commit
29368a64d1
@ -169,6 +169,12 @@ func resourceCloudFunctionsFunction() *schema.Resource {
|
|||||||
Optional: true,
|
Optional: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"runtime": {
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Optional: true,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
|
||||||
"environment_variables": {
|
"environment_variables": {
|
||||||
Type: schema.TypeMap,
|
Type: schema.TypeMap,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
@ -293,6 +299,7 @@ func resourceCloudFunctionsCreate(d *schema.ResourceData, meta interface{}) erro
|
|||||||
|
|
||||||
function := &cloudfunctions.CloudFunction{
|
function := &cloudfunctions.CloudFunction{
|
||||||
Name: cloudFuncId.cloudFunctionId(),
|
Name: cloudFuncId.cloudFunctionId(),
|
||||||
|
Runtime: d.Get("runtime").(string),
|
||||||
ForceSendFields: []string{},
|
ForceSendFields: []string{},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -376,6 +383,7 @@ func resourceCloudFunctionsRead(d *schema.ResourceData, meta interface{}) error
|
|||||||
}
|
}
|
||||||
d.Set("timeout", timeout)
|
d.Set("timeout", timeout)
|
||||||
d.Set("labels", function.Labels)
|
d.Set("labels", function.Labels)
|
||||||
|
d.Set("runtime", function.Runtime)
|
||||||
d.Set("environment_variables", function.EnvironmentVariables)
|
d.Set("environment_variables", function.EnvironmentVariables)
|
||||||
if function.SourceArchiveUrl != "" {
|
if function.SourceArchiveUrl != "" {
|
||||||
// sourceArchiveUrl should always be a Google Cloud Storage URL (e.g. gs://bucket/object)
|
// sourceArchiveUrl should always be a Google Cloud Storage URL (e.g. gs://bucket/object)
|
||||||
@ -458,6 +466,11 @@ func resourceCloudFunctionsUpdate(d *schema.ResourceData, meta interface{}) erro
|
|||||||
updateMaskArr = append(updateMaskArr, "labels")
|
updateMaskArr = append(updateMaskArr, "labels")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if d.HasChange("runtime") {
|
||||||
|
function.Runtime = d.Get("runtime").(string)
|
||||||
|
updateMaskArr = append(updateMaskArr, "runtime")
|
||||||
|
}
|
||||||
|
|
||||||
if d.HasChange("environment_variables") {
|
if d.HasChange("environment_variables") {
|
||||||
function.EnvironmentVariables = expandEnvironmentVariables(d)
|
function.EnvironmentVariables = expandEnvironmentVariables(d)
|
||||||
updateMaskArr = append(updateMaskArr, "environment_variables")
|
updateMaskArr = append(updateMaskArr, "environment_variables")
|
||||||
|
@ -105,6 +105,11 @@ func TestAccCloudFunctionsFunction_update(t *testing.T) {
|
|||||||
testAccCloudFunctionsFunctionHasLabel("my-label", "my-label-value", &function),
|
testAccCloudFunctionsFunctionHasLabel("my-label", "my-label-value", &function),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
ResourceName: funcResourceName,
|
||||||
|
ImportState: true,
|
||||||
|
ImportStateVerify: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
Config: testAccCloudFunctionsFunction_updated(functionName, bucketName, zipFileUpdatePath),
|
Config: testAccCloudFunctionsFunction_updated(functionName, bucketName, zipFileUpdatePath),
|
||||||
Check: resource.ComposeTestCheckFunc(
|
Check: resource.ComposeTestCheckFunc(
|
||||||
@ -124,6 +129,11 @@ func TestAccCloudFunctionsFunction_update(t *testing.T) {
|
|||||||
"new-env-variable-value", &function),
|
"new-env-variable-value", &function),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
ResourceName: funcResourceName,
|
||||||
|
ImportState: true,
|
||||||
|
ImportStateVerify: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -394,6 +404,7 @@ resource "google_cloudfunctions_function" "function" {
|
|||||||
source_archive_bucket = "${google_storage_bucket.bucket.name}"
|
source_archive_bucket = "${google_storage_bucket.bucket.name}"
|
||||||
source_archive_object = "${google_storage_bucket_object.archive.name}"
|
source_archive_object = "${google_storage_bucket_object.archive.name}"
|
||||||
trigger_http = true
|
trigger_http = true
|
||||||
|
runtime = "nodejs8"
|
||||||
timeout = 91
|
timeout = 91
|
||||||
entry_point = "helloGET"
|
entry_point = "helloGET"
|
||||||
labels {
|
labels {
|
||||||
|
@ -45,11 +45,10 @@ exported:
|
|||||||
* `description` - Description of the function.
|
* `description` - Description of the function.
|
||||||
* `available_memory_mb` - Available memory (in MB) to the function.
|
* `available_memory_mb` - Available memory (in MB) to the function.
|
||||||
* `timeout` - Function execution timeout (in seconds).
|
* `timeout` - Function execution timeout (in seconds).
|
||||||
|
* `runtime` - The runtime in which the function is running.
|
||||||
* `entry_point` - Name of a JavaScript function that will be executed when the Google Cloud Function is triggered.
|
* `entry_point` - Name of a JavaScript function that will be executed when the Google Cloud Function is triggered.
|
||||||
* `trigger_http` - If function is triggered by HTTP, this boolean is set.
|
* `trigger_http` - If function is triggered by HTTP, this boolean is set.
|
||||||
* `event_trigger` - A source that fires events in response to a condition in another service. Structure is documented below.
|
* `event_trigger` - A source that fires events in response to a condition in another service. Structure is documented below.
|
||||||
* `trigger_bucket` - If function is triggered by bucket, bucket name is set here. Deprecated. Use `event_trigger` instead.
|
|
||||||
* `trigger_topic` - If function is triggered by Pub/Sub topic, name of topic is set here. Deprecated. Use `event_trigger` instead.
|
|
||||||
* `https_trigger_url` - If function is triggered by HTTP, trigger URL is set here.
|
* `https_trigger_url` - If function is triggered by HTTP, trigger URL is set here.
|
||||||
* `labels` - A map of labels applied to this function.
|
* `labels` - A map of labels applied to this function.
|
||||||
|
|
||||||
|
@ -76,6 +76,8 @@ Deprecated. Use `event_trigger` instead.
|
|||||||
|
|
||||||
* `labels` - (Optional) A set of key/value label pairs to assign to the function.
|
* `labels` - (Optional) A set of key/value label pairs to assign to the function.
|
||||||
|
|
||||||
|
* `runtime` - (Optional) The runtime in which the function is going to run. If empty, defaults to `"nodejs6"`.
|
||||||
|
|
||||||
* `environment_variables` - (Optional) A set of key/value environment variable pairs to assign to the function.
|
* `environment_variables` - (Optional) A set of key/value environment variable pairs to assign to the function.
|
||||||
|
|
||||||
* `retry_on_failure` - (Optional) Whether the function should be retried on failure. This only applies to bucket and topic triggers, not HTTPS triggers.
|
* `retry_on_failure` - (Optional) Whether the function should be retried on failure. This only applies to bucket and topic triggers, not HTTPS triggers.
|
||||||
|
Loading…
Reference in New Issue
Block a user