-
Notifications
You must be signed in to change notification settings - Fork 545
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added datastream support in shared_vpc_access module (#788)
- Loading branch information
1 parent
91bfd40
commit a03c5e8
Showing
11 changed files
with
69 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,10 +27,12 @@ locals { | |
"dataflow.googleapis.com" : format("service-%[email protected]", local.service_project_number), | ||
"composer.googleapis.com" : format("service-%[email protected]", local.service_project_number) | ||
"vpcaccess.googleapis.com" : format("service-%[email protected]", local.service_project_number) | ||
"datastream.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") | ||
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") | ||
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}"] | ||
|
@@ -113,3 +115,15 @@ resource "google_project_iam_member" "gke_security_admin" { | |
role = "roles/compute.securityAdmin" | ||
member = format("serviceAccount:%s", local.apis["container.googleapis.com"]) | ||
} | ||
|
||
/****************************************** | ||
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 | ||
Service Account: service-[project_number]@gcp-sa-datastream.iam.gserviceaccount.com | ||
*****************************************/ | ||
resource "google_project_iam_member" "datastream_network_admin" { | ||
count = local.datastream_shared_vpc_enabled && var.enable_shared_vpc_service_project && var.grant_services_network_admin_role ? 1 : 0 | ||
project = var.host_project_id | ||
role = "roles/compute.networkAdmin" | ||
member = format("serviceAccount:%s", local.apis["datastream.googleapis.com"]) | ||
} |
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