https://github.com/jameswoolfenden/terraform-gcp-cloudfunction
For your cloud functions to GCP
https://github.com/jameswoolfenden/terraform-gcp-cloudfunction
cloudfunction gcp module terraform
Last synced: 9 months ago
JSON representation
For your cloud functions to GCP
- Host: GitHub
- URL: https://github.com/jameswoolfenden/terraform-gcp-cloudfunction
- Owner: JamesWoolfenden
- License: apache-2.0
- Created: 2019-11-12T20:16:10.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-01-26T12:18:17.000Z (almost 2 years ago)
- Last Synced: 2025-04-12T22:52:52.754Z (9 months ago)
- Topics: cloudfunction, gcp, module, terraform
- Language: HCL
- Homepage:
- Size: 66.4 KB
- Stars: 1
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# terraform-gcp-cloudfunction
[](https://github.com/JamesWoolfenden/terraform-gcp-cloudfunction/actions)
[](https://github.com/JamesWoolfenden/terraform-gcp-cloudfunction/releases/latest)
[](https://github.com/JamesWoolfenden/terraform-gcp-cloudfunction/releases/latest)

[](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=JamesWoolfenden%2Fterraform-gcp-cloudfunction&benchmark=CIS+AWS+V1.2)
[](https://github.com/pre-commit/pre-commit)
[](https://www.checkov.io/)
[](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=JamesWoolfenden%2Fterraform-gcp-cloudfunction&benchmark=INFRASTRUCTURE+SECURITY)
[](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=JamesWoolfenden%2Fterraform-gcp-cloudfunction&benchmark=CIS+GCP+V1.1)
The working cloudfunction module and example.
## Usage
Add **module.cloudfunction.tf** to your code:-
```terraform
module cloudfunction {
source ="jameswoolfenden/cloudfunction/gcp"
version = "0.0.4"
common_tags = var.common_tags
lambda = var.lambda
project = var.project
region = var.region
sourcezippath = var.sourcezippath
}
```
See **examplea.auto.tfvars** for the data to drive the module.
## Requirements
No requirements.
## Providers
| Name | Version |
|------|---------|
| [google](#provider\_google) | n/a |
## Modules
No modules.
## Resources
| Name | Type |
|------|------|
| [google_cloudfunctions_function.lambda](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/cloudfunctions_function) | resource |
| [google_cloudfunctions_function_iam_member.invoker](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/cloudfunctions_function_iam_member) | resource |
| [google_storage_bucket.bucket](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/storage_bucket) | resource |
| [google_storage_bucket_object.archive](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/storage_bucket_object) | resource |
## Inputs
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [common\_tags](#input\_common\_tags) | This is to help you add tags to your cloud objects | `map(any)` | n/a | yes |
| [invoker](#input\_invoker) | Set who can invoke the lambda | `any` | n/a | yes |
| [lambda](#input\_lambda) | A map object that populates the majority of cloudfunction settings | `map(any)` | n/a | yes |
| [location](#input\_location) | n/a | `string` | `"eu"` | no |
| [project](#input\_project) | GCP project | `string` | n/a | yes |
| [region](#input\_region) | GCP region | `string` | n/a | yes |
| [sourcezippath](#input\_sourcezippath) | Full path to source zip file | `string` | n/a | yes |
## Outputs
| Name | Description |
|------|-------------|
| [bucket](#output\_bucket) | n/a |
| [function](#output\_function) | n/a |
## Role and Permissions
The Terraform resource required is:
```golang
resource "google_project_iam_custom_role" "terraform_pike" {
project = "pike"
role_id = "terraform_pike"
title = "terraform_pike"
description = "A user with least privileges"
permissions = [
"cloudfunctions.functions.create",
"cloudfunctions.functions.delete",
"cloudfunctions.functions.get",
"cloudfunctions.functions.getIamPolicy",
"cloudfunctions.functions.setIamPolicy",
"cloudfunctions.functions.update",
"cloudfunctions.operations.get",
"iam.serviceAccounts.actAs",
"storage.buckets.create",
"storage.buckets.delete",
"storage.buckets.get",
"storage.buckets.update",
"storage.objects.create",
"storage.objects.delete",
"storage.objects.get"
]
}
```
## Related Projects
Check out these related projects.
- [terraform-aws-codecommit](https://github.com/jameswoolfenden/terraform-aws-codebuild) - Storing ones code
## Help
**Got a question?**
File a GitHub [issue](https://github.com/jameswoolfenden/terraform-gcp-cloudfunction/issues).
## Contributing
### Bug Reports & Feature Requests
Please use the [issue tracker](https://github.com/jameswoolfenden/terraform-gcp-cloudfunction/issues) to report any bugs or file feature requests.
## Copyrights
Copyright © 2019-2023 James Woolfenden
## License
[](https://opensource.org/licenses/Apache-2.0)
See [LICENSE](LICENSE) for full details.
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
### Contributors
[![James Woolfenden][jameswoolfenden_avatar]][jameswoolfenden_homepage]
[James Woolfenden][jameswoolfenden_homepage]
[jameswoolfenden_homepage]: https://github.com/jameswoolfenden
[jameswoolfenden_avatar]: https://github.com/jameswoolfenden.png?size=150