Skip to content

Commit

Permalink
Adds instructions of how to deploy and test the example, adds tfvars.…
Browse files Browse the repository at this point in the history
…example file
  • Loading branch information
amandakarina committed Jul 3, 2023
1 parent a7177c6 commit 8a8ffc0
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
35 changes: 35 additions & 0 deletions examples/secure_cloud_function_with_sql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,27 @@ _Note: Please refer to [Secure Web Proxy documentation](../../docs/secure-web-pr

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

To provision this example, run the following commands from within this directory:

* `mv terraform.tfvars.example terraform.tfvars` to rename the example `tfvars` file.
* Fill the `terraform.tfvars` with your values.
* `terraform init` to get the plugins.
* `terraform plan` to see the infrastructure plan.
* `terraform apply` to apply the infrastructure build.
* `terraform destroy` to destroy the built infrastructure.

### Testing

You can see the Secure Cloud Function running, forcing the Scheduler job to run.

* Go to [Cloud Scheduler console](https://console.cloud.google.com/cloudscheduler/).
* Select your Serverless project.
* Select the Scheduler Job and force run.
* Go to the [Cloud Function console](https://console.cloud.google.com/functions).
* Select your project and Cloud Function.
* Go to logs.
* When upload is done, you can see the Cloud Function logs consulting the Cloud SQL Database.

## Requirements

### Software
Expand Down Expand Up @@ -210,3 +231,17 @@ the resources of this module:
* Compute Shared VPC Admin: `roles/compute.xpnAdmin`
* Billing:
* Billing User: `roles/billing.user`

### Required APIs enabled at Service Account project

The service account project must have the following APIs enabled:

* Access Context Manager API: `accesscontextmanager.googleapis.com`
* Cloud Billing API: `cloudbilling.googleapis.com`
* Cloud Build API: `cloudbuild.googleapis.com`
* Cloud Key Management Service (KMS) API: `cloudkms.googleapis.com`
* Cloud Pub/Sub API: `pubsub.googleapis.com`
* Cloud SQL Admin API: `sqladmin.googleapis.com`
* Cloud Resource Manager API: `cloudresourcemanager.googleapis.com`
* Identity and Access Management (IAM) API: `iam.googleapis.com`
* Service Networking API: `servicenetworking.googleapis.com`
23 changes: 23 additions & 0 deletions examples/secure_cloud_function_with_sql/terraform.tfvars.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# /**
# * Copyright 2023 Google LLC
# *
# * Licensed 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
# *
# * http://www.apache.org/licenses/LICENSE-2.0
# *
# * 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.
# */

billing_account = "000000-000000-000000"
org_id = "000000000000000000"
folder_id = "000000000000"
create_access_context_manager_access_policy = false
access_context_manager_policy_id = "000000000000"
access_level_members = ["user:email@email.com"]
terraform_service_account = "ci-account@PROJECT.iam.gserviceaccount.com"

0 comments on commit 8a8ffc0

Please sign in to comment.