Skip to content

Commit 4c30016

Browse files
ludookarpok78
authored andcommitted
Update service activation in ngfw add-on (GoogleCloudPlatform#2823)
* align services use in ngfw add-on with swp * update ngfw README example
1 parent 08b49e3 commit 4c30016

File tree

6 files changed

+41
-20
lines changed

6 files changed

+41
-20
lines changed

fast/addons/2-networking-ngfw/README.md

+11-13
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,6 @@ certificate_authorities = {
110110
}
111111
}
112112
}
113-
ca_pool_config = {
114-
authz_nsec_sa = true
115-
name = "ca-pool-0"
116-
}
117113
}
118114
}
119115
ngfw_config = {
@@ -210,16 +206,18 @@ Security profiles group defined here are exported via output variable file, and
210206
| name | description | type | required | default | producer |
211207
|---|---|:---:|:---:|:---:|:---:|
212208
| [automation](variables-fast.tf#L28) | Automation resources created by the bootstrap stage. | <code title="object&#40;&#123;&#10; outputs_bucket &#61; string&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> || | <code>0-bootstrap</code> |
213-
| [ngfw_config](variables.tf#L106) | Configuration for NGFW Enterprise endpoints. Billing project defaults to the automation project. Network and TLS inspection policy ids support interpolation. | <code title="object&#40;&#123;&#10; endpoint_zones &#61; list&#40;string&#41;&#10; name &#61; optional&#40;string, &#34;ngfw-0&#34;&#41;&#10; network_associations &#61; optional&#40;map&#40;object&#40;&#123;&#10; vpc_id &#61; string&#10; disabled &#61; optional&#40;bool&#41;&#10; tls_inspection_policy &#61; optional&#40;string&#41;&#10; zones &#61; optional&#40;list&#40;string&#41;&#41;&#10; &#125;&#41;&#41;, &#123;&#125;&#41;&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> || | |
214-
| [organization](variables-fast.tf#L48) | Organization details. | <code title="object&#40;&#123;&#10; domain &#61; string&#10; id &#61; number&#10; customer_id &#61; string&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> || | <code>0-globals</code> |
215-
| [project_id](variables.tf#L127) | Project where the network security resources will be created. | <code>string</code> || | |
209+
| [ngfw_config](variables.tf#L113) | Configuration for NGFW Enterprise endpoints. Billing project defaults to the automation project. Network and TLS inspection policy ids support interpolation. | <code title="object&#40;&#123;&#10; endpoint_zones &#61; list&#40;string&#41;&#10; name &#61; optional&#40;string, &#34;ngfw-0&#34;&#41;&#10; network_associations &#61; optional&#40;map&#40;object&#40;&#123;&#10; vpc_id &#61; string&#10; disabled &#61; optional&#40;bool&#41;&#10; tls_inspection_policy &#61; optional&#40;string&#41;&#10; zones &#61; optional&#40;list&#40;string&#41;&#41;&#10; &#125;&#41;&#41;, &#123;&#125;&#41;&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> || | |
210+
| [organization](variables-fast.tf#L56) | Organization details. | <code title="object&#40;&#123;&#10; domain &#61; string&#10; id &#61; number&#10; customer_id &#61; string&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> || | <code>0-globals</code> |
211+
| [project_id](variables.tf#L134) | Project where the network security resources will be created. | <code>string</code> || | |
216212
| [_fast_debug](variables-fast.tf#L19) | Internal FAST variable used for testing and debugging. Do not use. | <code title="object&#40;&#123;&#10; skip_datasources &#61; optional&#40;bool, false&#41;&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> | | <code>&#123;&#125;</code> | |
217213
| [certificate_authorities](variables.tf#L17) | Certificate Authority Service pool and CAs. If host project ids is null identical pools and CAs are created in every host project. | <code title="map&#40;object&#40;&#123;&#10; location &#61; string&#10; iam &#61; optional&#40;map&#40;list&#40;string&#41;&#41;, &#123;&#125;&#41;&#10; iam_bindings &#61; optional&#40;map&#40;any&#41;, &#123;&#125;&#41;&#10; iam_bindings_additive &#61; optional&#40;map&#40;any&#41;, &#123;&#125;&#41;&#10; iam_by_principals &#61; optional&#40;map&#40;list&#40;string&#41;&#41;, &#123;&#125;&#41;&#10; ca_configs &#61; map&#40;object&#40;&#123;&#10; deletion_protection &#61; optional&#40;string, true&#41;&#10; type &#61; optional&#40;string, &#34;SELF_SIGNED&#34;&#41;&#10; is_ca &#61; optional&#40;bool, true&#41;&#10; lifetime &#61; optional&#40;string, null&#41;&#10; pem_ca_certificate &#61; optional&#40;string, null&#41;&#10; ignore_active_certificates_on_deletion &#61; optional&#40;bool, false&#41;&#10; skip_grace_period &#61; optional&#40;bool, true&#41;&#10; labels &#61; optional&#40;map&#40;string&#41;, null&#41;&#10; gcs_bucket &#61; optional&#40;string, null&#41;&#10; key_spec &#61; optional&#40;object&#40;&#123;&#10; algorithm &#61; optional&#40;string, &#34;RSA_PKCS1_2048_SHA256&#34;&#41;&#10; kms_key_id &#61; optional&#40;string, null&#41;&#10; &#125;&#41;, &#123;&#125;&#41;&#10; key_usage &#61; optional&#40;object&#40;&#123;&#10; cert_sign &#61; optional&#40;bool, true&#41;&#10; client_auth &#61; optional&#40;bool, false&#41;&#10; code_signing &#61; optional&#40;bool, false&#41;&#10; content_commitment &#61; optional&#40;bool, false&#41;&#10; crl_sign &#61; optional&#40;bool, true&#41;&#10; data_encipherment &#61; optional&#40;bool, false&#41;&#10; decipher_only &#61; optional&#40;bool, false&#41;&#10; digital_signature &#61; optional&#40;bool, false&#41;&#10; email_protection &#61; optional&#40;bool, false&#41;&#10; encipher_only &#61; optional&#40;bool, false&#41;&#10; key_agreement &#61; optional&#40;bool, false&#41;&#10; key_encipherment &#61; optional&#40;bool, true&#41;&#10; ocsp_signing &#61; optional&#40;bool, false&#41;&#10; server_auth &#61; optional&#40;bool, true&#41;&#10; time_stamping &#61; optional&#40;bool, false&#41;&#10; &#125;&#41;, &#123;&#125;&#41;&#10; subject &#61; optional&#40;&#10; object&#40;&#123;&#10; common_name &#61; string&#10; organization &#61; string&#10; country_code &#61; optional&#40;string&#41;&#10; locality &#61; optional&#40;string&#41;&#10; organizational_unit &#61; optional&#40;string&#41;&#10; postal_code &#61; optional&#40;string&#41;&#10; province &#61; optional&#40;string&#41;&#10; street_address &#61; optional&#40;string&#41;&#10; &#125;&#41;,&#10; &#123;&#10; common_name &#61; &#34;test.example.com&#34;&#10; organization &#61; &#34;Test Example&#34;&#10; &#125;&#10; &#41;&#10; subject_alt_name &#61; optional&#40;object&#40;&#123;&#10; dns_names &#61; optional&#40;list&#40;string&#41;, null&#41;&#10; email_addresses &#61; optional&#40;list&#40;string&#41;, null&#41;&#10; ip_addresses &#61; optional&#40;list&#40;string&#41;, null&#41;&#10; uris &#61; optional&#40;list&#40;string&#41;, null&#41;&#10; &#125;&#41;, null&#41;&#10; subordinate_config &#61; optional&#40;object&#40;&#123;&#10; root_ca_id &#61; optional&#40;string&#41;&#10; pem_issuer_certificates &#61; optional&#40;list&#40;string&#41;&#41;&#10; &#125;&#41;, null&#41;&#10; &#125;&#41;&#41;&#10; ca_pool_config &#61; optional&#40;object&#40;&#123;&#10; create_pool &#61; optional&#40;object&#40;&#123;&#10; name &#61; optional&#40;string&#41;&#10; tier &#61; optional&#40;string, &#34;DEVOPS&#34;&#41;&#10; &#125;&#41;&#41;&#10; use_pool &#61; optional&#40;object&#40;&#123;&#10; id &#61; string&#10; &#125;&#41;&#41;&#10; &#125;&#41;&#41;&#10;&#125;&#41;&#41;">map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code>&#123;&#125;</code> | |
218214
| [certificate_authority_pools](variables-fast.tf#L36) | Certificate authority pools. | <code title="map&#40;object&#40;&#123;&#10; id &#61; string&#10; ca_ids &#61; map&#40;string&#41;&#10; location &#61; string&#10;&#125;&#41;&#41;">map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code>&#123;&#125;</code> | <code>2-security</code> |
219-
| [names](variables.tf#L97) | Configuration for names used for output files. | <code title="object&#40;&#123;&#10; output_files_prefix &#61; optional&#40;string, &#34;2-networking-ngfw&#34;&#41;&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> | | <code>&#123;&#125;</code> | |
220-
| [outputs_location](variables.tf#L121) | Path where providers and tfvars files for the following stages are written. Leave empty to disable. | <code>string</code> | | <code>null</code> | |
221-
| [security_profiles](variables.tf#L133) | Security profile groups for Layer 7 inspection. Null environment list means all environments. | <code title="map&#40;object&#40;&#123;&#10; description &#61; optional&#40;string&#41;&#10; threat_prevention_profile &#61; optional&#40;object&#40;&#123;&#10; severity_overrides &#61; optional&#40;map&#40;object&#40;&#123;&#10; action &#61; string&#10; severity &#61; string&#10; &#125;&#41;&#41;&#41;&#10; threat_overrides &#61; optional&#40;map&#40;object&#40;&#123;&#10; action &#61; string&#10; threat_id &#61; string&#10; &#125;&#41;&#41;&#41;&#10; &#125;&#41;, &#123;&#125;&#41;&#10;&#125;&#41;&#41;">map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code title="&#123;&#10; ngfw-default &#61; &#123;&#125;&#10;&#125;">&#123;&#8230;&#125;</code> | |
222-
| [tls_inspection_policies](variables.tf#L175) | TLS inspection policies configuration. CA pools, trust configs and host project ids support interpolation. | <code title="map&#40;object&#40;&#123;&#10; ca_pool_id &#61; string&#10; location &#61; string&#10; exclude_public_ca_set &#61; optional&#40;bool&#41;&#10; trust_config &#61; optional&#40;string&#41;&#10; tls &#61; optional&#40;object&#40;&#123;&#10; custom_features &#61; optional&#40;list&#40;string&#41;&#41;&#10; feature_profile &#61; optional&#40;string&#41;&#10; min_version &#61; optional&#40;string&#41;&#10; &#125;&#41;, &#123;&#125;&#41;&#10;&#125;&#41;&#41;">map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code>&#123;&#125;</code> | |
223-
| [trust_configs](variables.tf#L217) | Certificate Manager trust configurations for TLS inspection policies. Project ids and region can reference keys in the relevant FAST variables. | <code title="map&#40;object&#40;&#123;&#10; location &#61; string&#10; description &#61; optional&#40;string&#41;&#10; allowlisted_certificates &#61; optional&#40;map&#40;string&#41;&#41;&#10; trust_stores &#61; optional&#40;map&#40;object&#40;&#123;&#10; intermediate_cas &#61; optional&#40;map&#40;string&#41;&#41;&#10; trust_anchors &#61; optional&#40;map&#40;string&#41;&#41;&#10; &#125;&#41;&#41;&#41;&#10;&#125;&#41;&#41;">map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code title="&#123;&#10;&#125;">&#123;&#8230;&#125;</code> | |
224-
| [vpc_self_links](variables-fast.tf#L58) | VPC network self links. | <code>map&#40;string&#41;</code> | | <code>&#123;&#125;</code> | <code>2-networking</code> |
215+
| [enable_services](variables.tf#L97) | Configure project by enabling services required for this add-on. | <code>bool</code> | | <code>true</code> | |
216+
| [host_project_ids](variables-fast.tf#L48) | Networking stage host project id aliases. | <code>map&#40;string&#41;</code> | | <code>&#123;&#125;</code> | <code>2-networking</code> |
217+
| [names](variables.tf#L104) | Configuration for names used for output files. | <code title="object&#40;&#123;&#10; output_files_prefix &#61; optional&#40;string, &#34;2-networking-ngfw&#34;&#41;&#10;&#125;&#41;">object&#40;&#123;&#8230;&#125;&#41;</code> | | <code>&#123;&#125;</code> | |
218+
| [outputs_location](variables.tf#L128) | Path where providers and tfvars files for the following stages are written. Leave empty to disable. | <code>string</code> | | <code>null</code> | |
219+
| [security_profiles](variables.tf#L140) | Security profile groups for Layer 7 inspection. Null environment list means all environments. | <code title="map&#40;object&#40;&#123;&#10; description &#61; optional&#40;string&#41;&#10; threat_prevention_profile &#61; optional&#40;object&#40;&#123;&#10; severity_overrides &#61; optional&#40;map&#40;object&#40;&#123;&#10; action &#61; string&#10; severity &#61; string&#10; &#125;&#41;&#41;&#41;&#10; threat_overrides &#61; optional&#40;map&#40;object&#40;&#123;&#10; action &#61; string&#10; threat_id &#61; string&#10; &#125;&#41;&#41;&#41;&#10; &#125;&#41;, &#123;&#125;&#41;&#10;&#125;&#41;&#41;">map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code title="&#123;&#10; ngfw-default &#61; &#123;&#125;&#10;&#125;">&#123;&#8230;&#125;</code> | |
220+
| [tls_inspection_policies](variables.tf#L182) | TLS inspection policies configuration. CA pools, trust configs and host project ids support interpolation. | <code title="map&#40;object&#40;&#123;&#10; ca_pool_id &#61; string&#10; location &#61; string&#10; exclude_public_ca_set &#61; optional&#40;bool&#41;&#10; trust_config &#61; optional&#40;string&#41;&#10; tls &#61; optional&#40;object&#40;&#123;&#10; custom_features &#61; optional&#40;list&#40;string&#41;&#41;&#10; feature_profile &#61; optional&#40;string&#41;&#10; min_version &#61; optional&#40;string&#41;&#10; &#125;&#41;, &#123;&#125;&#41;&#10;&#125;&#41;&#41;">map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code>&#123;&#125;</code> | |
221+
| [trust_configs](variables.tf#L224) | Certificate Manager trust configurations for TLS inspection policies. Project ids and region can reference keys in the relevant FAST variables. | <code title="map&#40;object&#40;&#123;&#10; location &#61; string&#10; description &#61; optional&#40;string&#41;&#10; allowlisted_certificates &#61; optional&#40;map&#40;string&#41;&#41;&#10; trust_stores &#61; optional&#40;map&#40;object&#40;&#123;&#10; intermediate_cas &#61; optional&#40;map&#40;string&#41;&#41;&#10; trust_anchors &#61; optional&#40;map&#40;string&#41;&#41;&#10; &#125;&#41;&#41;&#41;&#10;&#125;&#41;&#41;">map&#40;object&#40;&#123;&#8230;&#125;&#41;&#41;</code> | | <code title="&#123;&#10;&#125;">&#123;&#8230;&#125;</code> | |
222+
| [vpc_self_links](variables-fast.tf#L66) | VPC network self links. | <code>map&#40;string&#41;</code> | | <code>&#123;&#125;</code> | <code>2-networking</code> |
225223
<!-- END TFDOC -->

fast/addons/2-networking-ngfw/main.tf

+10-2
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,23 @@
1515
*/
1616

1717
locals {
18+
aliased_project_id = lookup(
19+
var.host_project_ids, var.project_id, var.project_id
20+
)
1821
project_id = try(module.project[0].project_id, var.project_id)
1922
}
2023

2124
module "project" {
2225
source = "../../../modules/project"
2326
count = var._fast_debug.skip_datasources == true ? 0 : 1
24-
name = var.project_id
27+
name = local.aliased_project_id
2528
project_create = false
26-
services = [
29+
service_agents_config = {
30+
services_enabled = [
31+
"networksecurity.googleapis.com"
32+
]
33+
}
34+
services = var.enable_services != true ? [] : [
2735
"certificatemanager.googleapis.com",
2836
"networkmanagement.googleapis.com",
2937
"networksecurity.googleapis.com",

fast/addons/2-networking-ngfw/tls-inspection.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ module "cas" {
4545
iam_bindings_additive = merge(
4646
each.value.iam_bindings_additive,
4747
var._fast_debug.skip_datasources == true ? {} : {
48-
nsec_agent = {
48+
nsec_certificate_manager = {
4949
member = module.project[0].service_agents["networksecurity"].iam_email
5050
role = "roles/privateca.certificateManager"
5151
}

fast/addons/2-networking-ngfw/variables-fast.tf

+8
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ variable "certificate_authority_pools" {
4545
default = {}
4646
}
4747

48+
variable "host_project_ids" {
49+
# tfdoc:variable:source 2-networking
50+
description = "Networking stage host project id aliases."
51+
type = map(string)
52+
nullable = false
53+
default = {}
54+
}
55+
4856
variable "organization" {
4957
# tfdoc:variable:source 0-globals
5058
description = "Organization details."

fast/addons/2-networking-ngfw/variables.tf

+7
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,13 @@ variable "certificate_authorities" {
9494
default = {}
9595
}
9696

97+
variable "enable_services" {
98+
description = "Configure project by enabling services required for this add-on."
99+
type = bool
100+
nullable = false
101+
default = true
102+
}
103+
97104
variable "names" {
98105
description = "Configuration for names used for output files."
99106
type = object({

fast/addons/2-networking-swp/tls-inspection.tf

+4-4
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ module "cas" {
3737
iam_bindings_additive = merge(
3838
var.certificate_authority.iam_bindings_additive,
3939
var._fast_debug.skip_datasources == true ? {} : {
40-
# nsec_certificate_manager = {
41-
# member = module.project[0].service_agents["networksecurity"].iam_email
42-
# role = "roles/privateca.certificateManager"
43-
# }
40+
nsec_certificate_manager = {
41+
member = module.project[0].service_agents["networksecurity"].iam_email
42+
role = "roles/privateca.certificateManager"
43+
}
4444
}
4545
)
4646
}

0 commit comments

Comments
 (0)