You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: gcp/README.md
+97-18Lines changed: 97 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ Before using this module, make sure you have the following:
8
8
9
9
1.[Terraform](https://www.terraform.io/) v1.0 or later installed on your local machine.
10
10
2. The [Google Cloud CLI](https://cloud.google.com/sdk/docs/install) installed on your local machine.
11
-
3. GCP credentials configured (`gcloud auth login`) with the necessary permissions to create:
11
+
3. GCP credentials configured with the necessary permissions to create:
12
12
- VPC networks and subnets
13
13
- Compute Engine instances and instance templates
14
14
- Service accounts and IAM bindings
@@ -21,36 +21,115 @@ Before using this module, make sure you have the following:
21
21
22
22
## Usage
23
23
24
-
To use this module in your Terraform configuration, add the following code in your existing Terraform code:
24
+
This is a quick example showing how to use this module. For more detailed examples with different deployment scenarios, refer to the [examples](./examples/) directory.
25
25
26
26
```hcl
27
-
variable "datadog-api-key" {}
27
+
variable "project_id" {
28
+
description = "GCP project ID"
29
+
type = string
30
+
}
31
+
32
+
variable "datadog_api_key" {
33
+
description = "Datadog API key with Remote Configuration enabled"
> Datadog strongly recommends [pinning](https://developer.hashicorp.com/terraform/language/modules/sources#selecting-a-revision) the version of the module to keep repeatable deployment and to avoid unexpected changes. Use a specific tag instead of a branch name.
68
+
69
+
### Configuration Notes
70
+
71
+
-**`site`**: Must match the Datadog site parameter of your account (see [Datadog site documentation](https://docs.datadoghq.com/getting_started/site/#access-the-datadog-site)). Common values: `datadoghq.com`, `datadoghq.eu`, `us3.datadoghq.com`, `us5.datadoghq.com`, `ap1.datadoghq.com`, `ap2.datadoghq.com`, `ddog-gov.com`.
72
+
-**`vpc_name`**: Name prefix for the VPC resources where the Agentless scanner is created. For security reasons, this VPC should be reserved for the exclusive use of the scanner.
73
+
-**`api_key`**: The Datadog API key is stored in Google Secret Manager and accessed by the scanner instances. Alternatively, you can use `api_key_secret_id` to reference an existing secret.
74
+
-**Service Accounts**: The module automatically creates two service accounts:
75
+
-**Scanner Service Account**: Attached to the compute instances, with permissions to read secrets and impersonate the target service account.
76
+
-**Impersonated Service Account**: Used for scanning resources, with read permissions on compute disks and snapshots.
77
+
78
+
## Examples
79
+
80
+
For complete examples, refer to the [examples](./examples/) directory:
Deploy scanners across multiple regions and scan multiple projects. **For enterprise deployments.**
91
+
92
+
- ✅ Multi-region deployment (US + EU by default, customizable)
93
+
- ✅ Cross-project scanning capability
94
+
- ✅ Minimized cross-region costs
95
+
- ✅ Centralized management
96
+
97
+
Each example includes detailed README instructions and complete Terraform code. **Start with single_region** if you're new to Agentless scanning.
98
+
99
+
## Uninstall
100
+
101
+
To uninstall, remove the Agentless scanner module from your Terraform code. Removing this module deletes all resources associated with the Agentless scanner. Alternatively, if you used a separate Terraform state for this setup, you can uninstall the Agentless scanner by executing `terraform destroy`.
102
+
103
+
> [!WARNING]
104
+
> Exercise caution when deleting Terraform resources. Review the plan carefully to ensure everything is in order. Note that some resources like Secret Manager secrets may have deletion protection enabled.
105
+
106
+
## Architecture
107
+
108
+
The Agentless Scanner deployment on GCP is split into different modules to allow for more flexibility and customization. The following modules are available:
109
+
110
+
-**[agentless-scanner-service-account](./modules/agentless-scanner-service-account/)**: Creates the service account that runs on the scanner compute instances. This service account has permissions to read the Datadog API key from Secret Manager and to impersonate the target service account.
111
+
-**[agentless-impersonated-service-account](./modules/agentless-impersonated-service-account/)**: Creates the target service account that is impersonated by the scanner for accessing and scanning GCP resources. This service account has read permissions on compute disks and snapshots.
112
+
-**[instance](./modules/instance/)**: Creates the Managed Instance Group (MIG) with compute instances that run the agentless scanner. The MIG provides auto-healing and distributes instances across multiple zones for high availability.
113
+
-**[vpc](./modules/vpc/)**: Creates the VPC network, subnet, Cloud Router, Cloud NAT, and firewall rules required for the agentless scanner. The scanner runs in a private subnet with outbound internet access through Cloud NAT.
114
+
115
+
The main module provided in this directory is a wrapper around these modules with simplified inputs. It creates a complete, production-ready deployment of the Agentless scanner.
1.**Network Isolation**: The scanner runs in a dedicated VPC with private instances that have no external IP addresses. Outbound connectivity is provided through Cloud NAT.
124
+
125
+
2.**Service Account Impersonation**: The scanner uses GCP's service account impersonation feature:
126
+
- The scanner service account (attached to instances) impersonates the target service account
127
+
- The target service account has the necessary permissions to read and scan compute resources
128
+
- This allows for fine-grained access control and cross-project scanning
129
+
130
+
3.**High Availability**: Instances are deployed in a regional Managed Instance Group distributed across multiple zones, with auto-healing enabled.
47
131
48
-
-`site` must match the Datadog site parameter of your account (see [this table](https://docs.datadoghq.com/getting_started/site/#access-the-datadog-site)).
49
-
-`vpc_name` is the name prefix for the VPC resources where the Agentless scanner
50
-
is created. For security reasons, this VPC should be reserved for
51
-
the exclusive use of the scanner.
52
-
- The scanner requires a service account with appropriate permissions to scan disks
53
-
in your GCP project. This module creates the necessary service accounts and IAM roles.
132
+
4.**Secure Credential Management**: The Datadog API key is stored in Google Secret Manager and accessed securely by the scanner instances.
0 commit comments