forked from GoogleCloudPlatform/magic-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Fix formatting on Cloud Functions docs (GoogleCloudPlatform#2469
)" This reverts commit 3e2011b.
- Loading branch information
Showing
3 changed files
with
19 additions
and
17 deletions.
There are no files selected for viewing
Submodule terraform
updated
from a0dfdc to 1db04e
Submodule terraform-beta
updated
from c39a62 to b4b3a5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,9 @@ to be invoked. See below examples for how to set up the appropriate permissions, | |
or view the [Cloud Functions IAM resources](/docs/providers/google/r/cloudfunctions_cloud_function_iam.html) | ||
for Cloud Functions. | ||
|
||
## Example Usage - Public Function | ||
## Example Usage | ||
|
||
Secured function with a user allowed to invoke: | ||
|
||
```hcl | ||
resource "google_storage_bucket" "bucket" { | ||
|
@@ -41,21 +43,30 @@ resource "google_cloudfunctions_function" "function" { | |
source_archive_bucket = "${google_storage_bucket.bucket.name}" | ||
source_archive_object = "${google_storage_bucket_object.archive.name}" | ||
trigger_http = true | ||
timeout = 60 | ||
entry_point = "helloGET" | ||
labels = { | ||
my-label = "my-label-value" | ||
} | ||
environment_variables = { | ||
MY_ENV_VAR = "my-env-var-value" | ||
} | ||
} | ||
# IAM entry for all users to invoke the function | ||
# Add IAM member for a user who can invoke the function (no admin actions) | ||
resource "google_cloudfunctions_function_iam_member" "invoker" { | ||
project = "${google_cloudfunctions_function.function.project}" | ||
region = "${google_cloudfunctions_function.function.region}" | ||
cloud_function = "${google_cloudfunctions_function.function.name}" | ||
role = "roles/cloudfunctions.invoker" | ||
member = "allUsers" | ||
member = "user:[email protected]" | ||
} | ||
``` | ||
|
||
## Example Usage - Single User | ||
A publically invocable function (similar behavior to functions created before | ||
private-by-default): | ||
|
||
```hcl | ||
resource "google_storage_bucket" "bucket" { | ||
|
@@ -77,28 +88,19 @@ resource "google_cloudfunctions_function" "function" { | |
source_archive_bucket = "${google_storage_bucket.bucket.name}" | ||
source_archive_object = "${google_storage_bucket_object.archive.name}" | ||
trigger_http = true | ||
timeout = 60 | ||
entry_point = "helloGET" | ||
labels = { | ||
my-label = "my-label-value" | ||
} | ||
environment_variables = { | ||
MY_ENV_VAR = "my-env-var-value" | ||
} | ||
} | ||
# IAM entry for a single user to invoke the function | ||
# Add IAM member for a user who can invoke the function (no admin actions) | ||
resource "google_cloudfunctions_function_iam_member" "invoker" { | ||
project = "${google_cloudfunctions_function.function.project}" | ||
region = "${google_cloudfunctions_function.function.region}" | ||
cloud_function = "${google_cloudfunctions_function.function.name}" | ||
role = "roles/cloudfunctions.invoker" | ||
member = "user:[email protected]" | ||
member = "allUsers" | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
The following arguments are supported: | ||
|