Skip to content

Commit 645f42e

Browse files
mike-pietruszka-sadaapeabodyimrannayer
authored
feat: added VPC network support to perimeter resources (#106)
Co-authored-by: Andrew Peabody <andrewpeabody@google.com> Co-authored-by: Imran Nayer <imrannayer@google.com>
1 parent be4f21d commit 645f42e

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

modules/regular_service_perimeter/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ module "regular_service_perimeter_1" {
105105
| perimeter\_name | Name of the perimeter. Should be one unified string. Must only be letters, numbers and underscores | `string` | n/a | yes |
106106
| policy | Name of the parent policy | `string` | n/a | yes |
107107
| resource\_keys | A list of keys to use for the Terraform state. The order should correspond to var.resources and the keys must not be dynamically computed. If `null`, var.resources will be used as keys. | `list(string)` | `null` | no |
108-
| resources | A list of GCP resources that are inside of the service perimeter. Currently only projects are allowed. | `list(string)` | `[]` | no |
109-
| resources\_dry\_run | (Dry-run) A list of GCP resources that are inside of the service perimeter. Currently only projects are allowed. If set, a dry-run policy will be set. | `list(string)` | `[]` | no |
108+
| resources | A list of GCP resources that are inside of the service perimeter. Currently only projects and VPC networks are allowed. | `list(string)` | `[]` | no |
109+
| resources\_dry\_run | (Dry-run) A list of GCP resources that are inside of the service perimeter. Currently only projects and VPC networks are allowed. If set, a dry-run policy will be set. | `list(string)` | `[]` | no |
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 |

modules/regular_service_perimeter/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,5 +210,5 @@ locals {
210210
resource "google_access_context_manager_service_perimeter_resource" "service_perimeter_resource" {
211211
for_each = local.resources
212212
perimeter_name = google_access_context_manager_service_perimeter.regular_service_perimeter.name
213-
resource = "projects/${each.value}"
213+
resource = can(regex("global/networks", each.value)) ? "//compute.googleapis.com/${each.value}" : "projects/${each.value}"
214214
}

modules/regular_service_perimeter/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ variable "restricted_services" {
3636
}
3737

3838
variable "resources" {
39-
description = "A list of GCP resources that are inside of the service perimeter. Currently only projects are allowed."
39+
description = "A list of GCP resources that are inside of the service perimeter. Currently only projects and VPC networks are allowed."
4040
type = list(string)
4141
default = []
4242
}
@@ -60,7 +60,7 @@ variable "restricted_services_dry_run" {
6060
}
6161

6262
variable "resources_dry_run" {
63-
description = "(Dry-run) A list of GCP resources that are inside of the service perimeter. Currently only projects are allowed. If set, a dry-run policy will be set."
63+
description = "(Dry-run) A list of GCP resources that are inside of the service perimeter. Currently only projects and VPC networks are allowed. If set, a dry-run policy will be set."
6464
type = list(string)
6565
default = []
6666
}

0 commit comments

Comments
 (0)