Skip to content

Commit

Permalink
Fix: Prevent diffs appearing when nothing has changed in PSC configs (#…
Browse files Browse the repository at this point in the history
…209)

* fix: Try setting this full url as that seems to cause a diff in TFC

* fix: change id to self link

* fix: ignore changes to region as this will never change
  • Loading branch information
danielpanzella authored Jan 21, 2025
1 parent a8dfd19 commit 60597e4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions modules/private_link/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ resource "google_compute_subnetwork" "proxy" {
ip_cidr_range = var.proxynetwork_cidr
purpose = "REGIONAL_MANAGED_PROXY"
role = "ACTIVE"
network = var.network.id
network = var.network.self_link
timeouts {
delete = "2m"
}
Expand All @@ -17,7 +17,11 @@ resource "google_compute_region_network_endpoint_group" "external_lb" {
region = data.google_client_config.current.region

network_endpoint_type = "INTERNET_FQDN_PORT"
network = var.network.id
network = var.network.self_link

lifecycle {
ignore_changes = [region]
}
}

resource "google_compute_region_network_endpoint" "external_lb" {
Expand Down Expand Up @@ -52,7 +56,7 @@ resource "google_compute_forwarding_rule" "internal_nlb" {

target = google_compute_region_target_tcp_proxy.internal_nlb.id

network = var.network.id
network = var.network.self_link
subnetwork = var.subnetwork.self_link

depends_on = [google_compute_subnetwork.proxy]
Expand All @@ -79,7 +83,7 @@ resource "google_compute_service_attachment" "default" {

resource "google_compute_subnetwork" "default" {
name = "${var.namespace}-psc-ilb-subnet"
network = var.network.id
network = var.network.self_link
purpose = "PRIVATE_SERVICE_CONNECT"
ip_cidr_range = var.psc_subnetwork
}
Expand All @@ -90,7 +94,7 @@ resource "google_compute_firewall" "default" {
name = "${var.namespace}-internal-fw"
provider = google-beta
direction = "INGRESS"
network = var.network.id
network = var.network.self_link
source_ranges = ["130.211.0.0/22", "35.191.0.0/16", "35.235.240.0/20", var.proxynetwork_cidr]
allow {
protocol = "tcp"
Expand Down
2 changes: 1 addition & 1 deletion modules/private_link/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ variable "namespace" {

variable "network" {
description = "Google Compute Engine network to which the cluster is connected."
type = object({ id = string })
type = object({ self_link = string })
}

variable "subnetwork" {
Expand Down

0 comments on commit 60597e4

Please sign in to comment.