Skip to content

Conversation

@pawan1210
Copy link
Contributor

No description provided.

@google-cla
Copy link

google-cla bot commented Mar 6, 2025

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.

@pawan1210 pawan1210 force-pushed the feat/internal-lb-cloud-run branch from fd1ab74 to c2f23ee Compare March 6, 2025 05:27
@pawan1210 pawan1210 changed the title Feat/internal lb cloud run Added example for internal cross-regional load balancer Mar 6, 2025
@pawan1210 pawan1210 changed the title Added example for internal cross-regional load balancer Feat: added example for internal cross-regional load balancer Mar 6, 2025
@pawan1210 pawan1210 force-pushed the feat/internal-lb-cloud-run branch 7 times, most recently from defff92 to c26b8fd Compare March 7, 2025 05:26
@pawan1210 pawan1210 marked this pull request as ready for review March 7, 2025 07:07
@pawan1210 pawan1210 requested review from a team, imrannayer and q2w as code owners March 7, 2025 07:07
resource "google_compute_global_address" "default_ipv6" {
provider = google-beta
count = local.is_internal ? 0 : (var.enable_ipv6 && var.create_ipv6_address) ? 1 : 0
count = local.is_internal_self_managed ? 0 : (var.enable_ipv6 && var.create_ipv6_address) ? 1 : 0
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this needed for INTERNAL_MANAGED?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, only for INTERNAL_SELF_MANAGED it's not needed. For INTERNAL_MANAGED, this can be used.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this address being used by module for INTERNAL_MANAGED?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, for initializing the 2 frontend cloudruns. Which forwards the request to http port of the forwarding rules.

@q2w
Copy link
Collaborator

q2w commented Mar 10, 2025

/gcbrun

1 similar comment
@q2w
Copy link
Collaborator

q2w commented Mar 11, 2025

/gcbrun

@q2w
Copy link
Collaborator

q2w commented Mar 11, 2025

With the examples, we need to add a integration test and update gcb file for integration test to test this example. Please add this as done in this PR GoogleCloudPlatform/terraform-google-regional-lb-http#28

@q2w
Copy link
Collaborator

q2w commented Mar 12, 2025

/gcbrun

4 similar comments
@q2w
Copy link
Collaborator

q2w commented Mar 12, 2025

/gcbrun

@pawan1210
Copy link
Contributor Author

/gcbrun

@pawan1210
Copy link
Contributor Author

/gcbrun

@pawan1210
Copy link
Contributor Author

/gcbrun

@pawan1210
Copy link
Contributor Author

/gcbrun

@q2w q2w force-pushed the feat/internal-lb-cloud-run branch from e89632c to 66cfc36 Compare March 17, 2025 03:20
@q2w q2w requested a review from ayushmjain as a code owner March 17, 2025 03:20
@bharathkkb bharathkkb changed the title Feat: added example for internal cross-regional load balancer Feat: support for internal cross-regional load balancer Mar 19, 2025
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.

Overall lgtm, cc @imrannayer if you have bandwidth for another pass

}

resource "google_compute_global_forwarding_rule" "internal_managed_http" {
count = local.create_http_forward && local.is_internal_managed ? length(var.internal_forwarding_rule_subnetworks) : 0
Copy link
Member

Choose a reason for hiding this comment

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

We should use for_each instead of count so we are not dependent on ordering of the list elements (here and below). This may need an update to the variable too since if we use set(list(..)), TF might complain if we dynamically create subnet. So maybe var could be map(string) where k=region, value =subnet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Member

Choose a reason for hiding this comment

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

@pawan1210 with index wouldn't we still have the problem of ordering. Fo example internal_forwarding_rules_config=[a,b]. For_each resource addressing becomes [0=>a, 1 =>b]. Now if value is updated to [b,a], then TF would want to delete and recreate?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As discussed added region and using it for creating resource names. Please check.


variable "internal_forwarding_rule_configs" {
description = "Map of internal managed forwarding rule configs. One of 'address' or 'subnetwork' is required for each."
type = map(object({
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we use list(object) here?

Suggested change
type = map(object({
type = list(object({
name = optional(string)
address = optional(string)
subnetwork = optional(string)
})

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Please check the latest changes

@bharathkkb bharathkkb merged commit 6200076 into terraform-google-modules:main Mar 21, 2025
4 checks passed
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.

3 participants