-
Notifications
You must be signed in to change notification settings - Fork 538
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: vpc user to run/functions + soft deletion policy #909
Open
diegolnasc
wants to merge
4
commits into
terraform-google-modules:master
Choose a base branch
from
diegolnasc:feat_vpc_gcs_config
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
5a9a7b7
feat: vpc user to run/functions + soft deletion policy
diegolnasc ff99caa
Merge branch 'master' into feat_vpc_gcs_config
diegolnasc 5369271
Merge branch 'master' into feat_vpc_gcs_config
apeabody 9357725
Merge branch 'master' into feat_vpc_gcs_config
apeabody File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,10 +31,12 @@ locals { | |
"notebooks.googleapis.com" : format("service-%[email protected]", local.service_project_number) | ||
"networkconnectivity.googleapis.com" : format("service-%[email protected]", local.service_project_number) | ||
} | ||
gke_shared_vpc_enabled = contains(var.active_apis, "container.googleapis.com") | ||
composer_shared_vpc_enabled = contains(var.active_apis, "composer.googleapis.com") | ||
datastream_shared_vpc_enabled = contains(var.active_apis, "datastream.googleapis.com") | ||
active_apis = [for api in keys(local.apis) : api if contains(var.active_apis, api)] | ||
gke_shared_vpc_enabled = contains(var.active_apis, "container.googleapis.com") | ||
composer_shared_vpc_enabled = contains(var.active_apis, "composer.googleapis.com") | ||
datastream_shared_vpc_enabled = contains(var.active_apis, "datastream.googleapis.com") | ||
run_vpc_serverless_enabled = contains(var.active_apis, "vpcaccess.googleapis.com") && contains(var.active_apis, "run.googleapis.com") | ||
functions_vpc_serverless_enabled = contains(var.active_apis, "vpcaccess.googleapis.com") && contains(var.active_apis, "cloudfunctions.googleapis.com") | ||
active_apis = [for api in keys(local.apis) : api if contains(var.active_apis, api)] | ||
# Can't use setproduct due to https://github.com/terraform-google-modules/terraform-google-project-factory/issues/635 | ||
subnetwork_api = length(var.shared_vpc_subnets) != 0 ? flatten([ | ||
for i, api in local.active_apis : [for i, subnet in var.shared_vpc_subnets : "${api},${subnet}"] | ||
|
@@ -146,6 +148,28 @@ resource "google_project_iam_member" "gke_security_admin" { | |
member = format("serviceAccount:%s", local.apis["container.googleapis.com"]) | ||
} | ||
|
||
/****************************************** | ||
roles/vpcaccess.user role granted to Cloud Run Service Agent for Run on shared VPC host project | ||
See: https://cloud.google.com/run/docs/configuring/shared-vpc-host-project | ||
*****************************************/ | ||
resource "google_project_iam_member" "cloud_run_vpc_access" { | ||
count = local.run_vpc_serverless_enabled ? 1 : 0 | ||
project = var.host_project_id | ||
role = "roles/vpcaccess.user" | ||
member = format("serviceAccount:service-%[email protected]", local.service_project_number) | ||
} | ||
|
||
/****************************************** | ||
roles/vpcaccess.user role granted to Cloud Functions Service Agent for Functions on shared VPC host project | ||
See: https://cloud.google.com/functions/docs/networking/shared-vpc-host-project | ||
*****************************************/ | ||
resource "google_project_iam_member" "functions_run_vpc_access" { | ||
count = local.functions_vpc_serverless_enabled ? 1 : 0 | ||
project = var.host_project_id | ||
role = "roles/vpcaccess.user" | ||
member = format("serviceAccount:service-%[email protected]", local.service_project_number) | ||
} | ||
|
||
/****************************************** | ||
roles/compute.networkAdmin role granted to Datastream's service account for datastream connectivity configuration on shared VPC host project | ||
See: https://cloud.google.com/datastream/docs/create-a-private-connectivity-configuration | ||
|
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion only: might be clearer to have the "enabled" outcome first, by checking
!= {}