Skip to content

Allow to set a different universe than GCP#1026

Open
ybelleguic wants to merge 1 commit intoterraform-google-modules:mainfrom
ybelleguic:handle-another-universe
Open

Allow to set a different universe than GCP#1026
ybelleguic wants to merge 1 commit intoterraform-google-modules:mainfrom
ybelleguic:handle-another-universe

Conversation

@ybelleguic
Copy link

and update service accounts name accordingly

@ybelleguic ybelleguic requested review from a team and imrannayer as code owners January 13, 2026 16:07
@google-cla
Copy link

google-cla bot commented Jan 13, 2026

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.

@gemini-code-assist
Copy link

Summary of Changes

Hello @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 universe_subdomain variable, the system can now correctly generate and reference service account email addresses tailored to these different environments, ensuring seamless operation and resource provisioning in diverse cloud setups.

Highlights

  • Support for Alternate Universes: Introduced a new universe_subdomain variable to allow the configuration of service accounts for environments other than the default GCP universe, such as 's3ns'.
  • Dynamic Service Account Naming: Modified the construction of various service account email addresses across multiple modules to dynamically incorporate the specified universe_subdomain, ensuring correct domain resolution for non-GCP environments.
  • Variable Propagation: The universe_subdomain variable has been added to top-level and sub-modules (project-factory, shared_vpc_access, gsuite_enabled, svpc_service_project) to ensure consistent propagation throughout the Terraform configuration.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

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"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

There is a typo in the Dataflow service account name. producter should be producer.

      service_account = "service-${local.service_project_number}@dataflow-service-producer-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"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

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"

@ybelleguic ybelleguic changed the title Allow to set a different universe than GCP, Allow to set a different universe than GCP Jan 13, 2026
@ybelleguic
Copy link
Author

CLA has been signed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant