Skip to content

Commit

Permalink
fix: formatting fixes (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
gtsorbo authored Apr 14, 2023
1 parent 1d7ea65 commit 3ffba20
Show file tree
Hide file tree
Showing 17 changed files with 185 additions and 260 deletions.
48 changes: 48 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# OSX leaves these everywhere on SMB shares
._*

# OSX trash
.DS_Store

# Python
*.pyc

# Emacs save files
*~
\#*\#
.\#*

# Vim-related files
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
*.un~
Session.vim
.netrwhist

### https://raw.github.com/github/gitignore/90f149de451a5433aebd94d02d11b0e28843a1af/Terraform.gitignore

# Local .terraform directories
**/.terraform/*

# .tfstate files
*.tfstate
*.tfstate.*

# Crash log files
crash.log

# Kitchen files
**/inspec.lock
**/.kitchen
**/kitchen.local.yml
**/Gemfile.lock

# Ignore any .tfvars files that are generated automatically for each Terraform run. Most
# .tfvars files are managed as part of configuration and so should be included in
# version control.
**/*.tfvars

credentials.json

# tf lock file
.terraform.lock.hcl
91 changes: 48 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,30 @@


# Cloud IDS Terraform Module
This module makes it easy to setup [Cloud IDS](https://cloud.google.com/ids), set up private services access and a packet mirroring policy. The packet mirroring policy requires at least one of the three below options:
This module makes it easy to setup [Cloud IDS](https://cloud.google.com/ids), set up [private services access](https://cloud.google.com/vpc/docs/private-services-access) and a [packet mirroring policy](https://cloud.google.com/vpc/docs/using-packet-mirroring).

The packet mirroring policy requires at least one of the three below options:
- [Tags](#pre_configured_rules): Up to 5 asset tags can be specified.
- [Subnets](#security_rules): Up to 5 subnets can be specified.
- [Instances](#custom_rules): Up to 50 instance can be specified.


## Compatibility

This module is meant for use with Terraform 1.3+ and tested using Terraform 1.3+. If you find incompatibilities using Terraform >=1.3, please open an issue.


## Assumptions and Prerequisites
This module assumes that below mentioned prerequisites are in place before consuming the module.

- All required APIs are enabled in the GCP Project
- servicenetworking.googleapis.com
- ids.googleapis.com
- logging.googleapis.com
- compute.googleapis.com
- Permissions are available



## Usage

```
```tf
module cloud_ids {
source = "GoogleCloudPlatform/terraform-google-cloud-ids"
project_id = "<PROJECT_ID>"
vpc_network_name = "<VPC_NETWORK_NAME>"
network_region = "<NETWORK_REGION>"
network_zone = "<NETWORK_ZONE>"
instance_list = "<INSTANCE_ID_LIST>"
subnet_list = "<SUBNET_ID_LIST>"
tag_list = "<TAG_LIST>"
instance_list = [
"projects/<PROJECT_ID>/zones/<ZONE-1>/instances/<INSTANCE-1>",
"projects/<PROJECT_ID>/zones/<ZONE-2>/instances/<INSTANCE-2>",
]
subnet_list = [
"projects/<PROJECT_ID>/regions/<ZONE-1>/subnetworks/<SUBNETWORK-1>",
"projects/<PROJECT_ID>/regions/<ZONE-1>/subnetworks/<SUBNETWORK-1>",
]
tag_list = ["<TAG-1>", "<TAG-2>", "<TAG-3>", "<TAG-4>"]
ids_private_ip_range_name = "ids-private-address"
ids_private_ip_address = "10.10.10.0"
ids_private_ip_prefix_length = 24
Expand All @@ -48,24 +36,6 @@ module cloud_ids {
}
```


Format for instance_list (includes instance_id), subnet_list (includes subnet_id) and tag_list variables is defined here.

```
instance_list = [
"projects/<PROJECT_ID>/zones/<ZONE-1>/instances/<INSTANCE-1>",
"projects/<PROJECT_ID>/zones/<ZONE-2>/instances/<INSTANCE-2>",
]
subnet_list = [
"projects/<PROJECT_ID>/regions/<ZONE-1>/subnetworks/<SUBNETWORK-1>",
"projects/<PROJECT_ID>/regions/<ZONE-1>/subnetworks/<SUBNETWORK-1>",
]
tag_list = ["<TAG-1>", "<TAG-2>", "<TAG-3>", "<TAG-4>"]
```


<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Inputs

Expand Down Expand Up @@ -96,7 +66,42 @@ tag_list = ["<TAG-1>", "<TAG-2>", "<TAG-3>", "<TAG-4>"]

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

## Requirements

These sections describe requirements for using this module.

### Software

The following dependencies must be available:

- [Terraform][terraform] v1.3
- [Terraform Provider for GCP][terraform-provider-gcp] plugin v3.53

### Service Account

A service account with the following roles must be used to provision
the resources of this module:

- Cloud IDS Admin: `roles/ids.admin`
- Compute Packet Mirroring User: `roles/compute.packetMirroringUser`
- Logs Viewer: `roles/logging.viewer`

The [Project Factory module][project-factory-module] and the
[IAM module][iam-module] may be used in combination to provision a
service account with the necessary roles applied.

### APIs

A project with the following APIs enabled must be used to host the
resources of this module:

- Cloud IDS API: `ids.googleapis.com`
- Cloud Logging API: `logging.googleapis.com`
- Compute Engine API: `compute.googleapis.com`
- Service Networking API: `servicenetworking.googleapis.com`

The [Project Factory module][project-factory-module] can be used to
provision a project with the necessary APIs enabled.

## Contributing

Expand Down
16 changes: 8 additions & 8 deletions build/int.cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ steps:
- 'TF_VAR_org_id=$_ORG_ID'
- 'TF_VAR_folder_id=$_FOLDER_ID'
- 'TF_VAR_billing_account=$_BILLING_ACCOUNT'
- id: simple-example-init
- id: cloud-ids-example-init
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'cft test run TestSimpleExample --stage init --verbose']
- id: simple-example-apply
args: ['/bin/bash', '-c', 'cft test run TestAll/examples/cloud_ids_example --stage init --verbose']
- id: cloud-ids-example-apply
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'cft test run TestSimpleExample --stage apply --verbose']
- id: simple-example-verify
args: ['/bin/bash', '-c', 'cft test run TestAll/examples/cloud_ids_example --stage apply --verbose']
- id: cloud-ids-example-verify
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'cft test run TestSimpleExample --stage verify --verbose']
- id: simple-example-teardown
args: ['/bin/bash', '-c', 'cft test run TestAll/examples/cloud_ids_example --stage verify --verbose']
- id: cloud-ids-example-teardown
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'cft test run TestSimpleExample --stage teardown --verbose']
args: ['/bin/bash', '-c', 'cft test run TestAll/examples/cloud_ids_example --stage teardown --verbose']
tags:
- 'ci'
- 'integration'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ Main resources:


## How to deploy?
The following steps should be executed in Cloud Shell in the Google Cloud Console.
The following steps should be executed in Cloud Shell in the Google Cloud Console.

### 1. Create a project and enable billing
Follow the steps in [this guide](https://cloud.google.com/resource-manager/docs/creating-managing-projects).


### 2. Deploy the infrastructure using Terraform

This terraform deployment requires the following variables.
This terraform deployment requires the following variables.

- demo_project_id = "YOUR_PROJECT_ID"
- vpc_network_name = "cloud-ids-vpc"
Expand Down Expand Up @@ -54,4 +54,4 @@ Navigate to `Cloud Console >> Network Security >> Cloud IDS >> Dashboard` to che
From the root folder of this repo, run the following command:
```
terraform destroy
```
```
Loading

0 comments on commit 3ffba20

Please sign in to comment.