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

fix: add service account access for gke in shared vpc #822

Merged
merged 2 commits into from
Jun 14, 2023

Conversation

tenminus11
Copy link
Contributor

According to https://cloud.google.com/kubernetes-engine/docs/how-to/cluster-shared-vpc#enabling_and_granting_roles

roles/compute.networkUser access on SERVICE_PROJECT_NUM@cloudservices.gserviceaccount.com in subnetwork is missing in the terraform module

current terraform module fails to deploy a usable cluster, and system related pods doesn't come up
This fix give the required access which is needed

@tenminus11 tenminus11 requested a review from a team as a code owner June 12, 2023 12:36
@tenminus11 tenminus11 changed the title add service account access for gke in shared vpc fix: add service account access for gke in shared vpc Jun 12, 2023
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 @tenminus11

IIRC we actually grant these in the main module. Are you using a different module to create projects?

resource "google_compute_subnetwork_iam_member" "apis_service_account_role_to_vpc_subnets" {
provider = google-beta
count = var.grant_network_role && var.enable_shared_vpc_service_project && length(var.shared_vpc_subnets) > 0 ? length(var.shared_vpc_subnets) : 0
subnetwork = element(
split("/", var.shared_vpc_subnets[count.index]),
index(
split("/", var.shared_vpc_subnets[count.index]),
"subnetworks",
) + 1,
)
role = "roles/compute.networkUser"
region = element(
split("/", var.shared_vpc_subnets[count.index]),
index(split("/", var.shared_vpc_subnets[count.index]), "regions") + 1,
)
project = var.shared_vpc
member = local.api_s_account_fmt
depends_on = [
module.project_services,
]
}

@bharathkkb
Copy link
Member

/gcbrun

@bharathkkb
Copy link
Member

/gcbrun

@bharathkkb
Copy link
Member

Discussed offline, usecase was for just svpc setup without project creation. This should be no-op if used together with main module.

@bharathkkb bharathkkb merged commit e133faf into terraform-google-modules:master Jun 14, 2023
4 checks passed
michalbagrowski pushed a commit to michalbagrowski/terraform-google-project-factory that referenced this pull request Jun 7, 2024
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

2 participants