forked from GoogleCloudPlatform/magic-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
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 (Goo…
…gleCloudPlatform#10147) * Access Context Manager - make ingress and egress rules immutable * Move immutable state to top level resource --------- Co-authored-by: Charles Leon <[email protected]>
- Loading branch information
1 parent
f642697
commit 8043f3c
Showing
4 changed files
with
93 additions
and
2 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 = "Storage 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" | ||
} |