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: Adding support for bringing your own service account
- Added data.google_service_account.cspm_service_account & data.google_service_account to fetch the service account in case var.create_service_account is false.
- Added var.create_service_account in cspm_iam, onboarding and project_attachment modules to not create service accounts in case var.create_service_account is false
- Added var.cspm_service_account_name in onboarding/iam, onboarding and projects_attachment modules
- Added var.aqua_tenant_id in project_attachment module
- Added var.aqua_tenant_id & onboarding_project_id in examples for aqua_gcp_projects_attachment module
- Updated single onboarding cspm service account name to "aqua-cspm-scanner-${var.aqua_tenant_id}" like in organization onboarding
- Updated README with instructions for Using Existing Service Accounts
- Removed var.aqua_tenant_id in onboarding & onboarding/iam modules
project_id = local.project_id # Existing project to be onboarded
138
+
project_id = local.project_id # Existing project to be onboarded
138
139
dedicated_project = local.dedicated
139
140
labels = local.aqua_custom_labels
140
141
onboarding_create_role_id = module.aqua_gcp_onboarding.create_role_id # Referencing outputs from the onboarding module
141
142
onboarding_service_account_email = module.aqua_gcp_onboarding.service_account_email # Referencing outputs from the onboarding module
142
143
onboarding_workload_identity_pool_id = module.aqua_gcp_onboarding.workload_identity_pool_id # Referencing outputs from the onboarding module
143
144
onboarding_workload_identity_pool_provider_id = module.aqua_gcp_onboarding.workload_identity_pool_provider_id # Referencing outputs from the onboarding module
144
145
onboarding_project_number = module.aqua_gcp_onboarding.project_number # Referencing outputs from the onboarding module
146
+
onboarding_project_id = module.aqua_gcp_onboarding.project_id # Referencing outputs from the onboarding module
project_id = each.value # Referencing each project from given project id list
280
+
project_id = each.value # Referencing each project from given project id list
279
281
dedicated_project = local.dedicated
280
282
labels = local.aqua_custom_labels
281
-
onboarding_create_role_id = module.aqua_gcp_onboarding.create_role_id # Referencing outputs from the onboarding module
282
-
onboarding_cspm_service_account_key = module.aqua_gcp_onboarding.cspm_service_account_key # Referencing outputs from the onboarding module
283
+
onboarding_create_role_id = module.aqua_gcp_onboarding.create_role_id # Referencing outputs from the onboarding module
284
+
onboarding_cspm_service_account_key = module.aqua_gcp_onboarding.cspm_service_account_key # Referencing outputs from the onboarding module
283
285
onboarding_service_account_email = module.aqua_gcp_onboarding.service_account_email # Referencing outputs from the onboarding module
284
286
onboarding_workload_identity_pool_id = module.aqua_gcp_onboarding.workload_identity_pool_id # Referencing outputs from the onboarding module
285
287
onboarding_workload_identity_pool_provider_id = module.aqua_gcp_onboarding.workload_identity_pool_provider_id # Referencing outputs from the onboarding module
286
288
onboarding_project_number = module.aqua_gcp_onboarding.project_number # Referencing outputs from the onboarding module
289
+
onboarding_project_id = module.aqua_gcp_onboarding.project_id # Referencing outputs from the onboarding module
287
290
depends_on = [module.aqua_gcp_onboarding]
288
291
}
289
292
@@ -298,7 +301,7 @@ For more examples and use cases, please refer to the examples folder in the repo
298
301
299
302
## Providing Project ID List
300
303
301
-
By default we fetch all active projects and use that project list, but you can also provide your own list of project IDs by populating the `projects_list` local. To accommodate this, ensure to remove the `module.aqua_gcp_org_projects` and then replace the local `projects_list` with your list.
304
+
By default, we fetch all active projects and use that project list, but you can also provide your own list of project IDs by populating the `projects_list` local. To accommodate this, ensure to remove the `module.aqua_gcp_org_projects` and then replace the local `projects_list` with your list.
302
305
303
306
```hcl
304
307
locals {
@@ -370,23 +373,68 @@ For example, if your Aqua tenant ID is `12345` and the first six characters of t
370
373
371
374
## Using Existing Network and Firewall
372
375
373
-
374
376
If you prefer to use an existing network and firewall instead of creating new ones,
375
377
you can do so by setting `create_network = false` in the onboarding module input variables.
376
378
In this case, you will need to create,
377
379
prior to onboarding, network and firewall resources with the following naming convention:
When using a dedicated project, the `<project_id>` should follow the format `"aqua-agentless-${local.tenant_id}-${local.org_hash}"` as mentioned above.
388
390
389
391
392
+
## Using Existing Service Accounts
393
+
394
+
By default, this module creates the necessary service accounts for you.
395
+
396
+
However, you can use existing service accounts by adding the flag `create_service_account = false` in the module’s input variables.
397
+
398
+
In dedicated project mode, ensure to create the service accounts within your provided dedicated project. Refer to the section [Using Dedicated Project](#using-an-existing-dedicated-project) for guidance on this setup.
399
+
400
+
Prior to onboarding, create the required service account and service account key resources with the following configurations:
401
+
402
+
### Service Account Configuration
403
+
-**CSPM Service Account Name**: `aqua-cspm-scanner-<aqua_tenant_id>`
404
+
-**CSPM Service Account Project ID**:
405
+
- Same: `<project_id>`
406
+
- Dedicated: `<dedicated_project_id>`
407
+
-**CSPM Service Account Key Format**: `json`
408
+
-**Agentless Service Account Name**: `aqua-agentless-sa-<aqua_tenant_id>`
409
+
-**Agentless Service Account Project ID**:
410
+
- Same: each `<project_id>`
411
+
- Dedicated: `<dedicated_project_id>`
412
+
413
+
414
+
After creating the required resources, supply the base64 encoded service account key for the CSPM service account in the `onboarding_cspm_service_account_key` parameter in the `aqua_gcp_projects_attachment` module.
415
+
Ensure to set `create_service_account` to `false` in both `aqua_gcp_onboarding` and `aqua_gcp_projects_attachment` modules, as well as `aqua_gcp_cspm_iam` module during organization same project mode, to skip the creation of service accounts.
416
+
417
+
For example:
418
+
419
+
```hcl
420
+
module "aqua_gcp_onboarding" {
421
+
source = "../../"
422
+
#(unchanged)
423
+
create_service_account = false # Set to false to skip service accounts creation
424
+
#(unchanged)
425
+
}
426
+
427
+
module "aqua_gcp_projects_attachment" {
428
+
source = "../../modules/project_attachment"
429
+
#(unchanged)
430
+
create_service_account = false # Set to false to skip service accounts creation
431
+
onboarding_cspm_service_account_key = "<base64-encoded-service-account-key>" # Referencing CSPM base64 encoded service account key created prior to onboarding
432
+
# You can optionally provide a decrypted service account key and use filebase64 function to encode it
@@ -428,7 +476,9 @@ When using a dedicated project, the `<project_id>` should follow the format `"aq
428
476
| <aname="input_aqua_volscan_api_url"></a> [aqua\_volscan\_api\_url](#input\_aqua\_volscan\_api\_url)| Aqua volume scanning API URL |`string`| n/a | yes |
429
477
| <aname="input_create_network"></a> [create\_network](#input\_create\_network)| Toggle to create network resources |`bool`|`true`| no |
430
478
| <aname="input_create_role_name"></a> [create\_role\_name](#input\_create\_role\_name)| The name of the role to be created for Aqua |`string`|`"AquaAutoConnectAgentlessRole"`| no |
479
+
| <aname="input_create_service_account"></a> [create\_service\_account](#input\_create\_service\_account)| Toggle to create service account |`bool`|`true`| no |
431
480
| <aname="input_cspm_role_name"></a> [cspm\_role\_name](#input\_cspm\_role\_name)| The name of the role used for CSPM |`string`|`"AquaAutoConnectCSPMRole"`| no |
481
+
| <aname="input_cspm_service_account_name"></a> [cspm\_service\_account\_name](#input\_cspm\_service\_account\_name)| Name of the CSPM service account. If not provided, the default value is set to 'aqua-cspm-scanner-<aqua\_tenant\_id>' in the 'cspm\_service\_account\_name' local |`string`|`null`| no |
432
482
| <aname="input_dedicated_project"></a> [dedicated\_project](#input\_dedicated\_project)| Indicates whether dedicated project is enabled |`bool`|`true`| no |
433
483
| <aname="input_delete_role_name"></a> [delete\_role\_name](#input\_delete\_role\_name)| The name of the role used for deleting Aqua resources |`string`|`"AutoConnectDeleteRole"`| no |
434
484
| <aname="input_identity_pool_name"></a> [identity\_pool\_name](#input\_identity\_pool\_name)| Name of the identity pool. If not provided, the default value is set to 'aqua-agentless-pool-<aqua\_tenant\_id>' in the 'identity\_pool\_name' local |`string`|`null`| no |
onboarding_workload_identity_pool_id=module.aqua_gcp_onboarding.workload_identity_pool_id# Referencing outputs from the onboarding module
121
122
onboarding_workload_identity_pool_provider_id=module.aqua_gcp_onboarding.workload_identity_pool_provider_id# Referencing outputs from the onboarding module
122
123
onboarding_project_number=module.aqua_gcp_onboarding.project_number# Referencing outputs from the onboarding module
124
+
onboarding_project_id=module.aqua_gcp_onboarding.project_id# Referencing outputs from the onboarding module
onboarding_workload_identity_pool_id=module.aqua_gcp_onboarding[each.value].workload_identity_pool_id# Referencing outputs from the onboarding module
96
97
onboarding_workload_identity_pool_provider_id=module.aqua_gcp_onboarding[each.value].workload_identity_pool_provider_id# Referencing outputs from the onboarding module
97
98
onboarding_project_number=module.aqua_gcp_onboarding[each.value].project_number# Referencing outputs from the onboarding module
onboarding_workload_identity_pool_id=module.aqua_gcp_onboarding[each.value].workload_identity_pool_id# Referencing outputs from the onboarding module
112
113
onboarding_workload_identity_pool_provider_id=module.aqua_gcp_onboarding[each.value].workload_identity_pool_provider_id# Referencing outputs from the onboarding module
113
114
onboarding_project_number=module.aqua_gcp_onboarding[each.value].project_number# Referencing outputs from the onboarding module
onboarding_workload_identity_pool_id=module.aqua_gcp_onboarding.workload_identity_pool_id# Referencing outputs from the onboarding module
95
96
onboarding_workload_identity_pool_provider_id=module.aqua_gcp_onboarding.workload_identity_pool_provider_id# Referencing outputs from the onboarding module
96
97
onboarding_project_number=module.aqua_gcp_onboarding.project_number# Referencing outputs from the onboarding module
98
+
onboarding_project_id=module.aqua_gcp_onboarding.project_id# Referencing outputs from the onboarding module
onboarding_workload_identity_pool_id=module.aqua_gcp_onboarding.workload_identity_pool_id# Referencing outputs from the onboarding module
134
137
onboarding_workload_identity_pool_provider_id=module.aqua_gcp_onboarding.workload_identity_pool_provider_id# Referencing outputs from the onboarding module
135
138
onboarding_project_number=module.aqua_gcp_onboarding.project_number# Referencing outputs from the onboarding module
139
+
onboarding_project_id=module.aqua_gcp_onboarding.project_id# Referencing outputs from the onboarding module
onboarding_workload_identity_pool_id=module.aqua_gcp_onboarding.workload_identity_pool_id# Referencing outputs from the onboarding module
95
96
onboarding_workload_identity_pool_provider_id=module.aqua_gcp_onboarding.workload_identity_pool_provider_id# Referencing outputs from the onboarding module
96
97
onboarding_project_number=module.aqua_gcp_onboarding.project_number# Referencing outputs from the onboarding module
98
+
onboarding_project_id=module.aqua_gcp_onboarding.project_id# Referencing outputs from the onboarding module
onboarding_workload_identity_pool_id=module.aqua_gcp_onboarding.workload_identity_pool_id# Referencing outputs from the onboarding module
74
75
onboarding_workload_identity_pool_provider_id=module.aqua_gcp_onboarding.workload_identity_pool_provider_id# Referencing outputs from the onboarding module
75
76
onboarding_project_number=module.aqua_gcp_onboarding.project_number# Referencing outputs from the onboarding module
77
+
onboarding_project_id=module.aqua_gcp_onboarding.project_id# Referencing outputs from the onboarding module
0 commit comments