Skip to content

Commit

Permalink
Revert "Fix formatting on Cloud Functions docs (GoogleCloudPlatform#2469
Browse files Browse the repository at this point in the history
)"

This reverts commit 3e2011b.
  • Loading branch information
JanMa authored Oct 25, 2019
1 parent 86ee42e commit f2ec6ed
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion build/terraform
2 changes: 1 addition & 1 deletion build/terraform-beta
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand All @@ -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" {
Expand All @@ -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:
Expand Down

0 comments on commit f2ec6ed

Please sign in to comment.