Skip to content
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

variablize networkUser role management #697

Merged

Conversation

vponnam
Copy link
Contributor

@vponnam vponnam commented Apr 5, 2022

In environments especially large sized with 100-to-1000s of projects and where networkUser role is explicitly managed outside of core_project_factory, it helps(sometimes required) to have the ability to not assign networkUser role to New Default Service Account, group_name, and Google APIs Service Account.

This change being an addition to the code, no breaking changes are expected.

cc @bharathkkb for context

@vponnam vponnam requested a review from a team as a code owner April 5, 2022 20:12
Copy link
Member

@bharathkkb bharathkkb left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @vponnam
I have a suggestion for renaming the variable as the scope is increasing since it would be a breaking change for users currently using grant_services_network_role=false.

main.tf Outdated Show resolved Hide resolved
@@ -179,7 +179,7 @@ resource "google_service_account_iam_member" "service_account_grant_to_group" {
compute.networkUser role granted to G Suite group, APIs Service account, and Project Service Account
*****************************************************************************************************************/
resource "google_project_iam_member" "controlling_group_vpc_membership" {
count = var.enable_shared_vpc_service_project && length(var.shared_vpc_subnets) == 0 ? local.shared_vpc_users_length : 0
count = var.grant_services_network_role && var.enable_shared_vpc_service_project && length(var.shared_vpc_subnets) == 0 ? local.shared_vpc_users_length : 0
Copy link
Member

Choose a reason for hiding this comment

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

@vponnam
Copy link
Contributor Author

vponnam commented Apr 6, 2022

cc @abelgana for context

docs/upgrading_to_project_factory_v13.0.md Outdated Show resolved Hide resolved
@@ -157,6 +157,42 @@
)
end
end

it "service project c with explicit subnets and grant_network_role flag set to false does not include project default service account in the roles/compute.networkUser IAM binding" do
Copy link
Member

Choose a reason for hiding this comment

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

Lets add also confirm via a test that binding is added for a different service projevt where the flag is true(i.e by default). Maybe

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this test scenario is cover for the service-project

@comment-bot-dev
Copy link

@vponnam
Thanks for the PR! 🚀
✅ Lint checks have passed.

@bharathkkb bharathkkb merged commit d309270 into terraform-google-modules:master Apr 8, 2022
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.

None yet

3 participants