-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Access Context Manager - make ingress and egress rules immutable
- Loading branch information
Charles Leon
committed
Mar 8, 2024
1 parent
1253916
commit f131707
Showing
4 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...emplates/terraform/examples/access_context_manager_service_perimeter_egress_policy.tf.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
resource "google_access_context_manager_service_perimeter" "storage-perimeter" { | ||
parent = "accesspolicies/${google_access_context_manager_access_policy.access-policy.name}" | ||
name = "accesspolicies/${google_access_context_manager_access_policy.access-policy.name}/serviceperimeters/storage-perimeter" | ||
title = "Storage Perimeter" | ||
status { | ||
restricted_services = ["storage.googleapis.com"] | ||
} | ||
lifecycle { | ||
ignore_changes = [status[0].resources] | ||
} | ||
} | ||
|
||
resource "google_access_context_manager_service_perimeter_egress_policy" "egress_policy" { | ||
perimeter = "${google_access_context_manager_service_perimeter.storage-perimeter.name}" | ||
egress_from { | ||
identity_type = "ANY_IDENTITY" | ||
} | ||
egress_to { | ||
resources = ["*"] | ||
operations { | ||
service_name = "bigquery.googleapis.com" | ||
method_selectors { | ||
method = "*" | ||
} | ||
} | ||
} | ||
lifecycle { | ||
create_before_destroy = true | ||
} | ||
} | ||
|
||
|
||
resource "google_access_context_manager_access_policy" "access-policy" { | ||
parent = "organizations/123456789" | ||
title = "test policy" | ||
} |
39 changes: 39 additions & 0 deletions
39
...mplates/terraform/examples/access_context_manager_service_perimeter_ingress_policy.tf.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
resource "google_access_context_manager_service_perimeter" "storage-perimeter" { | ||
parent = "accesspolicies/${google_access_context_manager_access_policy.access-policy.name}" | ||
name = "accesspolicies/${google_access_context_manager_access_policy.access-policy.name}/serviceperimeters/storage-perimeter" | ||
title = "Storage Perimeter" | ||
status { | ||
restricted_services = ["storage.googleapis.com"] | ||
} | ||
lifecycle { | ||
ignore_changes = [status[0].resources] | ||
} | ||
} | ||
|
||
resource "google_access_context_manager_service_perimeter_ingress_policy" "ingress_policy" { | ||
perimeter = "${google_access_context_manager_service_perimeter.storage-perimeter.name}" | ||
ingress_from { | ||
identity_type = "any_identity" | ||
sources { | ||
access_level = "*" | ||
} | ||
} | ||
ingress_to { | ||
resources = ["*"] | ||
operations { | ||
service_name = "bigquery.googleapis.com" | ||
method_selectors { | ||
method = "*" | ||
} | ||
} | ||
} | ||
lifecycle { | ||
create_before_destroy = true | ||
} | ||
} | ||
|
||
|
||
resource "google_access_context_manager_access_policy" "access-policy" { | ||
parent = "organizations/123456789" | ||
title = "Storage Policy" | ||
} |