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

added svpc subnet controls for project factory #2654

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

lnesteroff
Copy link
Collaborator

Adding option in project factory to define subnet level IAM for shared vpc.


Checklist

I applicable, I acknowledge that I have:

  • Read the contributing guide
  • Ran terraform fmt on all modified files
  • Regenerated the relevant README.md files using tools/tfdoc.py
  • Made sure all relevant tests pass

@@ -122,7 +122,10 @@ module "projects" {
for v in try(each.value.shared_vpc_service_config.network_users, []) :
lookup(local.context.iam_principals, v, v)
]
# TODO: network subnet users
network_subnet_users = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

we should add subnets to factories_config.contexts so we can try a substitution here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Do you mean something along these lines:

factories_config = {
  context = {
    network_subnet_users = {
      default = {
        "region/subnet" = ["gcp-devops"]
      }
    }
  }
}

So that project factories could attach a user/group to a default subnet? If the expectation is that that group/user should always have access to that subnet, it would only need to be applied once.

I also just added a service_subnet_iam_grants, which is similar to service_iam_grants and does the permissions based on modules/projects/sharedvpc-agent-iam.yaml, but applied the networkUser roles at the subnet level. I think that might make sense to have as a default, so if an org wants to allow compute.googleapis.com to be enabled on a default subnet on all projects it would add the agent.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think I misunderstood what we were doing with contexts. I've added a "subnets" context that we can use for substitutions.

@lnesteroff lnesteroff marked this pull request as draft November 7, 2024 04:22
@lnesteroff lnesteroff changed the title added network_subnet_users for project factory added svpc subnet controls for project factory Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants