-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: added sub-modules for PAM and Secure Source Manager (#222)
- Loading branch information
1 parent
d4e0a38
commit 87f34e0
Showing
88 changed files
with
1,988 additions
and
86 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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# DNS ZOne Example | ||
|
||
This example illustrates how to use the `privileged_access_manager` submodule | ||
|
||
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> | ||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| project\_id | Project ID to create BigQuery resources in | `string` | n/a | yes | | ||
|
||
## Outputs | ||
|
||
No outputs. | ||
|
||
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
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 @@ | ||
/** | ||
* Copyright 2024 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
module "entitlement" { | ||
source = "terraform-google-modules/iam/google//modules/privileged_access_manager" | ||
version = "~> 8.0" | ||
|
||
entitlement_id = "example-entitlement" | ||
parent_id = var.project_id | ||
parent_type = "project" | ||
entitlement_requesters = [ | ||
"user:requester@example.com", | ||
] | ||
entitlement_approvers = [ | ||
"user:approver@example.com", | ||
] | ||
role_bindings = [ | ||
{ | ||
role = "roles/storage.admin" | ||
condition_expression = "request.time < timestamp(\"2024-04-23T18:30:00.000Z\")" | ||
}, | ||
{ | ||
role = "roles/bigquery.admin" | ||
} | ||
] | ||
} |
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,20 @@ | ||
/** | ||
* Copyright 2024 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
variable "project_id" { | ||
type = string | ||
description = "Project ID to create BigQuery resources in" | ||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# DNS ZOne Example | ||
|
||
This example illustrates how to use the `privileged_access_manager` submodule | ||
|
||
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> | ||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| group\_email | Email for group to receive roles (ex. group@example.com) | `string` | n/a | yes | | ||
| project\_id | Project ID to create BigQuery resources in | `string` | n/a | yes | | ||
| sa\_email | Email for Service Account to receive roles (Ex. default-sa@example-project-id.iam.gserviceaccount.com) | `string` | n/a | yes | | ||
| user\_email | Email for user to receive roles (Ex. user@example.com) | `string` | n/a | yes | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| instance\_id | SSM Instance ID | | ||
| repository\_id | SSM repository ID | | ||
|
||
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
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,91 @@ | ||
/** | ||
* Copyright 2024 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
resource "google_secure_source_manager_instance" "default" { | ||
location = "us-central1" | ||
instance_id = "ssm-instance" | ||
project = var.project_id | ||
} | ||
|
||
resource "google_secure_source_manager_repository" "default" { | ||
project = var.project_id | ||
location = "us-central1" | ||
repository_id = "ssm-repo1" | ||
instance = google_secure_source_manager_instance.default.name | ||
|
||
description = "test repository" | ||
initial_config { | ||
default_branch = "main" | ||
} | ||
} | ||
|
||
module "ssm_instance_iam_binding" { | ||
source = "terraform-google-modules/iam/google//modules/secure_source_manager_iam" | ||
version = "~> 8.0" | ||
|
||
project = var.project_id | ||
location = "us-central1" | ||
|
||
entity_ids = { | ||
instance_ids = [google_secure_source_manager_instance.default.instance_id] | ||
} | ||
|
||
mode = "additive" | ||
|
||
bindings = { | ||
"roles/securesourcemanager.instanceAccessor" = [ | ||
"serviceAccount:${var.sa_email}", | ||
"group:${var.group_email}", | ||
"user:${var.user_email}", | ||
] | ||
"roles/securesourcemanager.instanceManager" = [ | ||
"serviceAccount:${var.sa_email}", | ||
"group:${var.group_email}", | ||
"user:${var.user_email}", | ||
] | ||
} | ||
|
||
depends_on = [google_secure_source_manager_instance.default] | ||
} | ||
|
||
module "ssm_repository_iam_binding" { | ||
source = "terraform-google-modules/iam/google//modules/secure_source_manager_iam" | ||
version = "~> 8.0" | ||
|
||
project = var.project_id | ||
location = "us-central1" | ||
|
||
entity_ids = { | ||
repository_ids = [google_secure_source_manager_repository.default.repository_id] | ||
} | ||
|
||
mode = "additive" | ||
|
||
bindings = { | ||
"roles/securesourcemanager.repoReader" = [ | ||
"serviceAccount:${var.sa_email}", | ||
"group:${var.group_email}", | ||
"user:${var.user_email}", | ||
] | ||
"roles/securesourcemanager.repoWriter" = [ | ||
"serviceAccount:${var.sa_email}", | ||
"group:${var.group_email}", | ||
"user:${var.user_email}", | ||
] | ||
} | ||
|
||
depends_on = [google_secure_source_manager_repository.default] | ||
} |
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,25 @@ | ||
/** | ||
* Copyright 2024 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
output "instance_id" { | ||
value = google_secure_source_manager_instance.default.instance_id | ||
description = "SSM Instance ID" | ||
} | ||
|
||
output "repository_id" { | ||
value = google_secure_source_manager_repository.default.repository_id | ||
description = "SSM repository ID" | ||
} |
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,35 @@ | ||
/** | ||
* Copyright 2024 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
variable "group_email" { | ||
type = string | ||
description = "Email for group to receive roles (ex. group@example.com)" | ||
} | ||
|
||
variable "sa_email" { | ||
type = string | ||
description = "Email for Service Account to receive roles (Ex. default-sa@example-project-id.iam.gserviceaccount.com)" | ||
} | ||
|
||
variable "user_email" { | ||
type = string | ||
description = "Email for user to receive roles (Ex. user@example.com)" | ||
} | ||
|
||
variable "project_id" { | ||
type = string | ||
description = "Project ID to create BigQuery resources in" | ||
} |
Oops, something went wrong.