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

Add support for PSC network attachments and interfaces in modules #2125

Merged
merged 6 commits into from
Mar 4, 2024

Conversation

ludoo
Copy link
Collaborator

@ludoo ludoo commented Mar 3, 2024

This PR implements support for PSC network attachments and interfaces. The design moves from Fabric principles, and

  • implements support for network attachments in the net-vpc module, to allow network owners to directly define them
  • implements support for network attachments in the net-address module, to allow the use case of creating attachments from Shared VPC service projects
  • implements support for network attached interfaces in the compute-vm module

At a lower level, the design choice on where and how to implement support (apart from the obvious choice of the vm module), moves from a few simple considerations.

The net-vpc variable design uses a separate variable, as network attachments have a 1:1 relationship with subnets (single subnet per attachment), and subnets have a 1:n relationship with attachments (multiple attachments possible per subnet).
Implementing support directly in the subnets variable would have made it overly verbose; using a separate variable for attachments keeps the variable types simpler, and follows the same design principle used for proxy only and psc subnets, which allows to clearly identify a family of resources in variables at a glance (as opposed to IAM which we consider a resource configuration).

The choice of implementing support for attachment creation in service projects in the net-address module moves from the fact that at a high level, a network attachment is not entirely dissimilar from reserving subnet addresses ("If a network attachment accepts a connection from a Private Service Connect interface, Google Cloud allocates to the interface an internal IP address from a consumer subnet that's specified by the network attachment" from the GCP docs). Implementing the same in the net-vpc module would have resulted in weird configurations, where the project passed to the module did not match the one where the resource needs to be created (host vs service), and subnets would still have to be specified by full URL without being internally referenced by the module who would not be managing them.

The compute-vm module support for attached interfaces has been implemented via a dedicated variable, as the type is radically different from regular network interfaces, and would have resulted in a very intricate variable with lots of corner cases to be addressed in validation. This choice also makes it obvious that at least one regular network interface is still required even when attached interfaces are used.

The module changes have been tested with actual apply commands in my own setup.

@ludoo ludoo enabled auto-merge (squash) March 3, 2024 12:53
Copy link
Collaborator

@juliocc juliocc left a comment

Choose a reason for hiding this comment

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

great stuff

@ludoo ludoo merged commit da68d3c into master Mar 4, 2024
13 checks passed
@ludoo ludoo deleted the ludo/psc-interfaces branch March 4, 2024 09:12
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