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 for perma-diff when using PSC NEGs. #2772

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions modules/net-lb-app-ext-regional/negs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ resource "google_compute_region_network_endpoint_group" "psc" {
psc_target_service = each.value.psc.target_service
network = each.value.psc.network
subnetwork = each.value.psc.subnetwork
lifecycle {
# ignore until https://github.com/hashicorp/terraform-provider-google/issues/20576 is fixed
ignore_changes = [psc_data]
}
}

resource "google_compute_region_network_endpoint_group" "serverless" {
Expand Down
4 changes: 4 additions & 0 deletions modules/net-lb-app-ext/negs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ resource "google_compute_region_network_endpoint_group" "psc" {
psc_target_service = each.value.psc.target_service
network = each.value.psc.network
subnetwork = each.value.psc.subnetwork
lifecycle {
# ignore until https://github.com/hashicorp/terraform-provider-google/issues/20576 is fixed
ignore_changes = [psc_data]
}
}

resource "google_compute_region_network_endpoint_group" "serverless" {
Expand Down
4 changes: 4 additions & 0 deletions modules/net-lb-app-int-cross-region/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,8 @@ resource "google_compute_region_network_endpoint_group" "psc" {
psc_target_service = each.value.psc.target_service
network = each.value.psc.network
subnetwork = each.value.psc.subnetwork
lifecycle {
# ignore until https://github.com/hashicorp/terraform-provider-google/issues/20576 is fixed
ignore_changes = [psc_data]
}
}
21 changes: 13 additions & 8 deletions modules/net-lb-app-int/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Due to the complexity of the underlying resources, changes to the configuration
- [Files](#files)
- [Variables](#variables)
- [Outputs](#outputs)
- [Fixtures](#fixtures)
<!-- END TOC -->

### Minimal Example
Expand Down Expand Up @@ -375,7 +376,7 @@ module "ilb-l7" {
source = "./fabric/modules/net-lb-app-int"
name = "ilb-test"
project_id = var.project_id
region = "europe-west1"
region = var.region
backend_service_configs = {
default = {
backends = [{
Expand All @@ -388,8 +389,8 @@ module "ilb-l7" {
neg_configs = {
my-neg = {
psc = {
region = "europe-west1"
target_service = "europe-west1-cloudkms.googleapis.com"
region = var.region
target_service = "${var.region}-cloudkms.googleapis.com"
}
}
}
Expand All @@ -398,7 +399,7 @@ module "ilb-l7" {
subnetwork = var.subnet.self_link
}
}
# tftest modules=1 resources=5
# tftest modules=1 resources=5 e2e
```

#### Internet NEG creation
Expand Down Expand Up @@ -561,11 +562,11 @@ module "ilb-l7" {
source = "./fabric/modules/net-lb-app-int"
name = "ilb-test"
project_id = var.project_id
region = "europe-west1"
region = var.region
backend_service_configs = {
default = {
backends = [{
group = "projects/myprj/zones/europe-west1-a/instanceGroups/my-ig"
group = module.compute-vm-group-b.group.id
}]
}
}
Expand All @@ -575,14 +576,14 @@ module "ilb-l7" {
}
service_attachment = {
nat_subnets = [var.subnet_psc_1.self_link]
automatic_connection = true
automatic_connection = false
consumer_accept_lists = {
# map of `project_id` => `connection_limit`
(var.project_id) = 10
}
}
}
# tftest modules=1 resources=6
# tftest modules=3 resources=10 fixtures=fixtures/compute-vm-group-bc.tf e2e
```

### Complex example
Expand Down Expand Up @@ -774,4 +775,8 @@ For deploying changes to load balancer configuration please refer to [net-lb-app
| [psc_neg_ids](outputs.tf#L68) | Autogenerated PSC network endpoint group ids. | |
| [regional_neg_ids](outputs.tf#L75) | Autogenerated regional network endpoint group ids. | |
| [service_attachment_id](outputs.tf#L82) | Id of the service attachment. | |

## Fixtures

- [compute-vm-group-bc.tf](../../tests/fixtures/compute-vm-group-bc.tf)
<!-- END TFDOC -->
5 changes: 5 additions & 0 deletions modules/net-lb-app-int/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ resource "google_compute_region_network_endpoint_group" "psc" {
psc_target_service = each.value.psc.target_service
network = each.value.psc.network
subnetwork = each.value.psc.subnetwork
lifecycle {
# ignore until https://github.com/hashicorp/terraform-provider-google/issues/20576 is fixed
ignore_changes = [psc_data]
}

}

locals {
Expand Down
4 changes: 4 additions & 0 deletions modules/net-lb-proxy-int/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ resource "google_compute_region_network_endpoint_group" "psc" {
psc_target_service = each.value.psc.target_service
network = each.value.psc.network
subnetwork = each.value.psc.subnetwork
lifecycle {
# ignore until https://github.com/hashicorp/terraform-provider-google/issues/20576 is fixed
ignore_changes = [psc_data]
}
}

# Internet NEG
Expand Down
Loading