Skip to content

Commit 38eb822

Browse files
authored
feat: Support for VPCs in dry-run mode (#117)
1 parent 0e5db63 commit 38eb822

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

modules/regular_service_perimeter/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ module "regular_service_perimeter_1" {
110110
| restricted\_services | GCP services that are subject to the Service Perimeter restrictions. Must contain a list of services. For example, if storage.googleapis.com is specified, access to the storage buckets inside the perimeter must meet the perimeter's access restrictions. | `list(string)` | `[]` | no |
111111
| restricted\_services\_dry\_run | (Dry-run) GCP services that are subject to the Service Perimeter restrictions. Must contain a list of services. For example, if storage.googleapis.com is specified, access to the storage buckets inside the perimeter must meet the perimeter's access restrictions. If set, a dry-run policy will be set. | `list(string)` | `[]` | no |
112112
| shared\_resources | A map of lists of resources to share in a Bridge perimeter module. Each list should contain all or a subset of the perimeters resources | `object({ all = list(string) })` | <pre>{<br> "all": []<br>}</pre> | no |
113-
| vpc\_accessible\_services | A list of [VPC Accessible Services](https://cloud.google.com/vpc-service-controls/docs/vpc-accessible-services) that will be restricted within the VPC Network. Use ["\*"] to allow any service (disable VPC Accessible Services); Use ["RESTRICTED-SERVICES"] to match the restricted services list; Use [] to not allow any service. | `list(string)` | <pre>[<br> "*"<br>]</pre> | no |
114-
| vpc\_accessible\_services\_dry\_run | (Dry-run) A list of [VPC Accessible Services](https://cloud.google.com/vpc-service-controls/docs/vpc-accessible-services) that will be restricted within the VPC Network. Use ["\*"] to allow any service (disable VPC Accessible Services); Use ["RESTRICTED-SERVICES"] to match the restricted services list; Use [] to not allow any service. | `list(string)` | <pre>[<br> "*"<br>]</pre> | no |
113+
| vpc\_accessible\_services | A list of [VPC Accessible Services](https://cloud.google.com/vpc-service-controls/docs/vpc-accessible-services) that will be restricted within the VPC Network. Use ["*"] to allow any service (disable VPC Accessible Services); Use ["RESTRICTED-SERVICES"] to match the restricted services list; Use [] to not allow any service. | `list(string)` | <pre>[<br> "*"<br>]</pre> | no |
114+
| vpc\_accessible\_services\_dry\_run | (Dry-run) A list of [VPC Accessible Services](https://cloud.google.com/vpc-service-controls/docs/vpc-accessible-services) that will be restricted within the VPC Network. Use ["*"] to allow any service (disable VPC Accessible Services); Use ["RESTRICTED-SERVICES"] to match the restricted services list; Use [] to not allow any service. | `list(string)` | <pre>[<br> "*"<br>]</pre> | no |
115115

116116
## Outputs
117117

modules/regular_service_perimeter/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ resource "google_access_context_manager_service_perimeter" "regular_service_peri
112112
for_each = local.dry_run ? ["dry-run"] : []
113113
content {
114114
restricted_services = var.restricted_services_dry_run
115-
resources = formatlist("projects/%s", var.resources_dry_run)
115+
resources = [for item in var.resources_dry_run : can(regex("global/networks", item)) ? format("//compute.googleapis.com/%s", item) : format("projects/%s", item)]
116116
access_levels = formatlist(
117117
"accessPolicies/${var.policy}/accessLevels/%s",
118118
var.access_levels_dry_run

0 commit comments

Comments
 (0)