Skip to content

Commit

Permalink
Remove validation on Cloud Functions available_memory_mb (#4702) (#8946)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Apr 19, 2021
1 parent e096238 commit 32226c9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 20 deletions.
3 changes: 3 additions & 0 deletions .changelog/4702.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
cloudfunctions: removed bounds on the supported memory range in `google_cloudfunctions_function.available_memory_mb`
```
20 changes: 1 addition & 19 deletions google/resource_cloudfunctions_function.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,6 @@ import (
"time"
)

var functionAllowedMemory = map[int]bool{
128: true,
256: true,
512: true,
1024: true,
2048: true,
4096: true,
}

var allowedIngressSettings = []string{
"ALLOW_ALL",
"ALLOW_INTERNAL_AND_GCLB",
Expand Down Expand Up @@ -173,16 +164,7 @@ func resourceCloudFunctionsFunction() *schema.Resource {
Type: schema.TypeInt,
Optional: true,
Default: 256,
Description: `Memory (in MB), available to the function. Default value is 256MB. Allowed values are: 128MB, 256MB, 512MB, 1024MB, and 2048MB.`,
ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) {
availableMemoryMB := v.(int)

if !functionAllowedMemory[availableMemoryMB] {
errors = append(errors, fmt.Errorf("Allowed values for memory (in MB) are: %s . Got %d",
joinMapKeys(&functionAllowedMemory), availableMemoryMB))
}
return
},
Description: `Memory (in MB), available to the function. Default value is 256. Possible values include 128, 256, 512, 1024, etc.`,
},

"timeout": {
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/cloudfunctions_function.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Eg. `"nodejs8"`, `"nodejs10"`, `"nodejs12"`, `"python37"`, `"python38"`,`"go111"

* `description` - (Optional) Description of the function.

* `available_memory_mb` - (Optional) Memory (in MB), available to the function. Default value is 256MB. Allowed values are: 128MB, 256MB, 512MB, 1024MB, 2048MB and 4096MB.
* `available_memory_mb` - (Optional) Memory (in MB), available to the function. Default value is `256`. Possible values include `128`, `256`, `512`, `1024`, etc.

* `timeout` - (Optional) Timeout (in seconds) for the function. Default value is 60 seconds. Cannot be more than 540 seconds.

Expand Down

0 comments on commit 32226c9

Please sign in to comment.