Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 23 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,6 @@ This repository provides a structured set of Terraform modules for deploying Che
2. [Install Terraform](https://learn.hashicorp.com/tutorials/terraform/install-cli) and read the Terraform getting started guide that follows. This guide will assume basic proficiency with Terraform - it is an introduction to the Google provider.

### Configuring the Provider
The **main.tf** file includes the following provider configuration block used to configure the credentials you use to authenticate with GCP, as well as a default project and location for your resources:
```
provider "google" {
credentials = file(var.service_account_path)
project = var.project
region = var.region
}
...
```

1. [Create a Service Account](https://cloud.google.com/docs/authentication/getting-started) (or use the existing one). Next, download the JSON key file. Name it something you can remember and store it somewhere secure on your machine. <br/>
2. Select "Editor" Role or verify you have the following permissions:
```
Expand Down Expand Up @@ -59,43 +49,25 @@ provider "google" {
compute.subnetworks.useExternalIp
iam.serviceAccounts.actAs
```
3. ```credentials``` - Your service account key file is used to complete a two-legged OAuth 2.0 flow to obtain access tokens to authenticate with the GCP API as needed; Terraform will use it to reauthenticate automatically when tokens expire. <br/>
3. Configure the provider in your `main.tf` file. Your service account key file is used to complete a two-legged OAuth 2.0 flow to obtain access tokens to authenticate with the GCP API as needed; Terraform will use it to reauthenticate automatically when tokens expire. <br/>
The provider credentials can be provided either as static credentials or as [Environment Variables](https://www.terraform.io/docs/providers/google/guides/provider_reference.html#credentials-1).
- Static credentials can be provided by adding the path to your service-account json file, project-id and region in /gcp/modules/autoscale-into-new-vpc/**terraform.tfvars** file as follows:
```
service_account_path = "service-accounts/service-account-file-name.json"
project = "project-id"
region = "us-central1"
```
- In case the Environment Variables are used, perform modifications described below:<br/>
a. The next lines in the main.tf file, in the provider google resource, need to be deleted or commented:
- **Static credentials**: Specify the path to your service account key file in your `main.tf`:

```hcl
provider "google" {
credentials = "path/to/service-account-key.json"
project = "your-project-id"
region = "your-region"
}
```

- **Environment Variables**: If you prefer to use environment variables (e.g., `GOOGLE_APPLICATION_CREDENTIALS`, `GOOGLE_PROJECT`), you can omit credentials and project from the provider block:

```hcl
provider "google" {
// credentials = file(var.service_account_path)
// project = var.project

region = var.region
region = "your-region"
}
```
b.In the terraform.tfvars file leave empty double quotes for credentials and project variables:
```
service_account_path = ""
project = ""
```
## Usage
- Fill all variables in the /gcp/autoscale-into-existing-vpc/**terraform.tfvars** file with proper values (see below for variables descriptions).
- From a command line initialize the Terraform configuration directory:
```
terraform init
```
- Create an execution plan:
```
terraform plan
```
- Create or modify the deployment:
```
terraform apply
```
```

## Repository Structure
`Submodules:` Contains modular, reusable, production-grade Terraform components, each with its own documentation.
Expand All @@ -104,6 +76,9 @@ The provider credentials can be provided either as static credentials or as [Env


**Submodules:**
* [`single`](https://registry.terraform.io/modules/CheckPointSW/cloudguard-network-security/gcp/latest/submodules/single) - Deploys a single Check Point Security Gateway or Management Server.
* [`cluster`](https://registry.terraform.io/modules/CheckPointSW/cloudguard-network-security/gcp/latest/submodules/cluster) - Deploys a Check Point Security Gateway cluster (high availability).
* [`autoscale`](https://registry.terraform.io/modules/CheckPointSW/cloudguard-network-security/gcp/latest/submodules/autoscale) - Deploys Check Point Security Gateways with auto-scaling capabilities.
* [`network-security-integration`](https://registry.terraform.io/modules/CheckPointSW/cloudguard-network-security/gcp/latest/submodules/network-security-integration) - Deploys GCP Network Security Integration.

Internal Submodules -
Expand All @@ -112,6 +87,7 @@ Internal Submodules -
* [`internal-load-balancer`](https://registry.terraform.io/modules/CheckPointSW/cloudguard-network-security/gcp/latest/submodules/internal-load-balancer) - Deploys internal load balanncer.
* [`network-and-subnet`](https://registry.terraform.io/modules/CheckPointSW/cloudguard-network-security/gcp/latest/submodules/network-and-subnet) - Deploys VPC and subnetwork in the VPC.
* [`network-security-integration-common`](https://registry.terraform.io/modules/CheckPointSW/cloudguard-network-security/gcp/latest/submodules/network-security-integration-common) - Deploys Network Security Integration.
* [`compute-image`](https://registry.terraform.io/modules/CheckPointSW/cloudguard-network-security/gcp/latest/submodules/computes-image) - Deploy using last image to OS version.


***
Expand All @@ -123,13 +99,15 @@ Add the required module in your Terraform configuration file (`main.tf`) to depl

```hcl
provider "google" {
features {}
credentials = "path/to/service-account-key.json"
project = "your-project-id"
region = "your-region"
}

module "example_module" {
source = "CheckPointSW/cloudguard-network-security/gcp//modules/{module_name}"
version = "{chosen_version}"
# Add the required inputs
// Add the required inputs
}
```
---
Expand Down
Loading