Allow to set a different universe than GCP#1026
Allow to set a different universe than GCP#1026ybelleguic wants to merge 1 commit intoterraform-google-modules:mainfrom
Conversation
…ts name accordingly
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Summary of ChangesHello @ybelleguic, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the flexibility of the Terraform modules by enabling support for alternative cloud universes beyond standard Google Cloud Platform. By introducing a configurable Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces support for different GCP universes by allowing a universe_subdomain to be specified. This new variable is used to construct service account names with the correct domain for the target universe. The changes are mostly plumbing the new variable through the modules and updating string formats. I've found a few issues related to correctness and consistency in how the service account emails are constructed, including a typo, an incorrect service account format for Cloud Build, and an inconsistent domain for the cloudservices service agent. Please see my detailed comments.
| } | ||
| "cloudbuild.googleapis.com" : { | ||
| service_account = format("%s@cloudbuild.gserviceaccount.com", local.service_project_number) | ||
| service_account = "service-${local.service_project_number}@cloudbuild.${local.universe_subdomain}gserviceaccount.com" |
There was a problem hiding this comment.
The format for the Cloud Build service account appears to be incorrect. The service- prefix is not part of the standard [PROJECT_NUMBER]@cloudbuild.gserviceaccount.com service account. This change mixes the legacy service account format with the service agent format and will likely result in an invalid service account email. Please remove the service- prefix.
service_account = "${local.service_project_number}@cloudbuild.${local.universe_subdomain}gserviceaccount.com"
| }, | ||
| "dataflow.googleapis.com" : { | ||
| service_account = format("service-%s@dataflow-service-producer-prod.iam.gserviceaccount.com", local.service_project_number) | ||
| service_account = "service-${local.service_project_number}@dataflow-service-producter-prod.${local.universe_subdomain}iam.gserviceaccount.com" |
| ) | ||
| project = var.host_project_id | ||
| member = format("serviceAccount:%s@cloudservices.gserviceaccount.com", local.service_project_number) | ||
| member = "serviceAccount:${local.service_project_number}@cloudservices.${local.universe_subdomain}gserviceaccount.com" |
There was a problem hiding this comment.
The construction of the cloudservices service account email for universe domains is inconsistent with the implementation in modules/core_project_factory/main.tf. It's missing the .iam part of the domain for universe configurations. This will lead to an incorrect service account email when a universe_subdomain is specified.
member = "serviceAccount:${local.service_project_number}@cloudservices.${local.universe_subdomain}${var.universe_subdomain != null ? "iam." : ""}gserviceaccount.com"
|
CLA has been signed |
and update service accounts name accordingly