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
feat(scanning)!: Deploy gcr subscriptions for each project (#64)
The gcr topic is now assumed to be existing in all the projects that are
going to be scanned as part of the organization.
Last implementation relied on Eventarc triggers to retrieve the events from GCR / Artifact Registry into the Cloud Run deployment. That works for single-project deployments, but organizational deployments require the use of subscriptions sending the events to the HTTP endpoint of the Cloud Run deployment instead.
BREAKING CHANGE: This adds a new variable called project_scan_ids which specifies the IDs of the projects where a subscription must be created for the expected gcr topic in each project, and removes the create_gcr_topic variable which may be confusing to the users, since some of the scanned projects may or may not contain this topic, and verifying if it exists is not an option.
* feat(scanning): Add gcr subscription deployments for each project
* chore: remove unsed datas and fix scanning push url
* feat: Add project_scan_ids and remove create_gcr_topic variable
* fix(ci): Add gcr topic to organizational test
* fix(ci): Create gcr topic as part of single_project test
* feat: Mark project_scan_ids as required
* fix: Add ArtifactRegistry permissions to GCR pull
Co-authored-by: Hayk Kocharyan <[email protected]>
A2: Verify that `gcr` topic exists. If `create_gcr_topic` is set to false and `gcr` topic is not found, the GCR scanning is ommited and won't be deployed. For more info see GCR PubSub topic.
124
124
125
125
- Q3: Scanning, I get an error saying:
126
126
```
127
-
error starting scan runner for image ****: rpc error: code = PermissionDenied desc = Cloud Build API has not been used in project *** before or it is disabled.
128
-
Enable it by visiting https://console.developers.google.com/apis/api/cloudbuild.googleapis.com/overview?project=*** then retry.
127
+
error starting scan runner for image ****: rpc error: code = PermissionDenied desc = Cloud Build API has not been used in project *** before or it is disabled.
128
+
Enable it by visiting https://console.developers.google.com/apis/api/cloudbuild.googleapis.com/overview?project=*** then retry.
129
129
If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry
130
130
```
131
131
A3: Do as the error says and activate CloudBuild API. Check the list of all the required APIs that need to be activated per feature module.
| <aname="input_project_id"></a> [project\_id](#input\_project\_id)| Organization member project ID where the secure-for-cloud workload is going to be deployed |`string`| n/a | yes |
99
+
| <aname="input_project_scan_ids"></a> [project\_scan\_ids](#input\_project\_scan\_ids)| Projects where a subscription must be created to pull events from their GCR topics. Warning, the topic called `gcr` must already exist in each provided project. |`list(string)`| n/a | yes |
| <aname="input_benchmark_project_ids"></a> [benchmark\_project\_ids](#input\_benchmark\_project\_ids)| Google cloud project IDs to run Benchmarks on |`list(string)`|`[]`| no |
98
102
| <aname="input_benchmark_regions"></a> [benchmark\_regions](#input\_benchmark\_regions)| List of regions in which to run the benchmark. If empty, the task will contain all regions by default. |`list(string)`|`[]`| no |
99
103
| <aname="input_benchmark_role_name"></a> [benchmark\_role\_name](#input\_benchmark\_role\_name)| The name of the Service Account that will be created. |`string`|`"sysdigcloudbench"`| no |
100
-
| <aname="input_create_gcr_topic"></a> [create\_gcr\_topic](#input\_create\_gcr\_topic)| Deploys a PubSub topic called `gcr` as part of this stack, which is needed for GCR scanning. Set to `true` only if it doesn't exist yet. If this is not deployed, and no existing `gcr` topic is found, the GCR scanning is ommited and won't be deployed. For more info see [GCR PubSub topic](https://cloud.google.com/container-registry/docs/configuring-notifications#create_a_topic). |`bool`|`true`| no |
101
104
| <aname="input_deploy_bench"></a> [deploy\_bench](#input\_deploy\_bench)| whether benchmark module is to be deployed |`bool`|`true`| no |
102
105
| <aname="input_location"></a> [location](#input\_location)| Zone where the stack will be deployed |`string`|`"us-central1"`| no |
103
106
| <aname="input_max_instances"></a> [max\_instances](#input\_max\_instances)| Max number of instances for the workloads |`number`|`1`| no |
Copy file name to clipboardExpand all lines: examples/organization/variables.tf
+11-13Lines changed: 11 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,11 @@ variable "project_id" {
14
14
description="Organization member project ID where the secure-for-cloud workload is going to be deployed"
15
15
}
16
16
17
+
variable"project_scan_ids" {
18
+
type=list(string)
19
+
description="Projects where a subscription must be created to pull events from their GCR topics. Warning, the topic called `gcr` must already exist in each provided project."
20
+
}
21
+
17
22
# --------------------------
18
23
# optionals, with defaults
19
24
# --------------------------
@@ -46,19 +51,6 @@ variable "max_instances" {
46
51
default=1
47
52
}
48
53
49
-
variable"create_gcr_topic" {
50
-
type=bool
51
-
description="Deploys a PubSub topic called `gcr` as part of this stack, which is needed for GCR scanning. Set to `true` only if it doesn't exist yet. If this is not deployed, and no existing `gcr` topic is found, the GCR scanning is ommited and won't be deployed. For more info see [GCR PubSub topic](https://cloud.google.com/container-registry/docs/configuring-notifications#create_a_topic)."
52
-
default=true
53
-
}
54
-
55
-
variable"deploy_bench" {
56
-
type=bool
57
-
description="whether benchmark module is to be deployed"
58
-
default=true
59
-
}
60
-
61
-
62
54
variable"benchmark_regions" {
63
55
type=list(string)
64
56
description="List of regions in which to run the benchmark. If empty, the task will contain all regions by default."
|[google_project.project](https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/project)| data source |
51
-
|[google_pubsub_topic.gcr](https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/pubsub_topic)| data source |
52
53
53
54
## Inputs
54
55
@@ -66,6 +67,7 @@ No modules.
66
67
| <aname="input_location"></a> [location](#input\_location)| Zone where the cloud scanning will be deployed |`string`|`"us-central1"`| no |
67
68
| <aname="input_max_instances"></a> [max\_instances](#input\_max\_instances)| Max number of instances for the Cloud Scanning |`number`|`1`| no |
68
69
| <aname="input_name"></a> [name](#input\_name)| Name to be assigned to all child resources. A suffix may be added internally when required. Use default value unless you need to install multiple instances |`string`|`"sfc-cloudscanning"`| no |
70
+
| <aname="input_project_scan_ids"></a> [project\_scan\_ids](#input\_project\_scan\_ids)| Projects where a subscription must be created to pull events from their GCR topics to scan their images. Warning, a topic called `gcr` must already exist in each provided project. |`list(string)`|`[]`| no |
69
71
| <aname="input_verify_ssl"></a> [verify\_ssl](#input\_verify\_ssl)| Verify the SSL certificate of the Secure endpoint |`bool`|`true`| no |
Copy file name to clipboardExpand all lines: modules/services/cloud-scanning/variables.tf
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -75,3 +75,9 @@ variable "max_instances" {
75
75
description="Max number of instances for the Cloud Scanning"
76
76
default=1
77
77
}
78
+
79
+
variable"project_scan_ids" {
80
+
type=list(string)
81
+
description="Projects where a subscription must be created to pull events from their GCR topics to scan their images. Warning, a topic called `gcr` must already exist in each provided project."
0 commit comments