Fix for perma-diff when using PSC NEGs.
Provider issue: https://github.com/hashicorp/terraform-provider-google/issues/20576
This commit is contained in:
committed by
Wiktor Niesiobędzki
parent
6d51c8da4d
commit
3337f0be0e
@@ -89,6 +89,10 @@ resource "google_compute_region_network_endpoint_group" "psc" {
|
|||||||
psc_target_service = each.value.psc.target_service
|
psc_target_service = each.value.psc.target_service
|
||||||
network = each.value.psc.network
|
network = each.value.psc.network
|
||||||
subnetwork = each.value.psc.subnetwork
|
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" {
|
resource "google_compute_region_network_endpoint_group" "serverless" {
|
||||||
|
|||||||
@@ -130,6 +130,10 @@ resource "google_compute_region_network_endpoint_group" "psc" {
|
|||||||
psc_target_service = each.value.psc.target_service
|
psc_target_service = each.value.psc.target_service
|
||||||
network = each.value.psc.network
|
network = each.value.psc.network
|
||||||
subnetwork = each.value.psc.subnetwork
|
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" {
|
resource "google_compute_region_network_endpoint_group" "serverless" {
|
||||||
|
|||||||
@@ -163,4 +163,8 @@ resource "google_compute_region_network_endpoint_group" "psc" {
|
|||||||
psc_target_service = each.value.psc.target_service
|
psc_target_service = each.value.psc.target_service
|
||||||
network = each.value.psc.network
|
network = each.value.psc.network
|
||||||
subnetwork = each.value.psc.subnetwork
|
subnetwork = each.value.psc.subnetwork
|
||||||
|
lifecycle {
|
||||||
|
# ignore until https://github.com/hashicorp/terraform-provider-google/issues/20576 is fixed
|
||||||
|
ignore_changes = [psc_data]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ Due to the complexity of the underlying resources, changes to the configuration
|
|||||||
- [Files](#files)
|
- [Files](#files)
|
||||||
- [Variables](#variables)
|
- [Variables](#variables)
|
||||||
- [Outputs](#outputs)
|
- [Outputs](#outputs)
|
||||||
|
- [Fixtures](#fixtures)
|
||||||
<!-- END TOC -->
|
<!-- END TOC -->
|
||||||
|
|
||||||
### Minimal Example
|
### Minimal Example
|
||||||
@@ -375,7 +376,7 @@ module "ilb-l7" {
|
|||||||
source = "./fabric/modules/net-lb-app-int"
|
source = "./fabric/modules/net-lb-app-int"
|
||||||
name = "ilb-test"
|
name = "ilb-test"
|
||||||
project_id = var.project_id
|
project_id = var.project_id
|
||||||
region = "europe-west1"
|
region = var.region
|
||||||
backend_service_configs = {
|
backend_service_configs = {
|
||||||
default = {
|
default = {
|
||||||
backends = [{
|
backends = [{
|
||||||
@@ -388,8 +389,8 @@ module "ilb-l7" {
|
|||||||
neg_configs = {
|
neg_configs = {
|
||||||
my-neg = {
|
my-neg = {
|
||||||
psc = {
|
psc = {
|
||||||
region = "europe-west1"
|
region = var.region
|
||||||
target_service = "europe-west1-cloudkms.googleapis.com"
|
target_service = "${var.region}-cloudkms.googleapis.com"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -398,7 +399,7 @@ module "ilb-l7" {
|
|||||||
subnetwork = var.subnet.self_link
|
subnetwork = var.subnet.self_link
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# tftest modules=1 resources=5
|
# tftest modules=1 resources=5 e2e
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Internet NEG creation
|
#### Internet NEG creation
|
||||||
@@ -561,11 +562,11 @@ module "ilb-l7" {
|
|||||||
source = "./fabric/modules/net-lb-app-int"
|
source = "./fabric/modules/net-lb-app-int"
|
||||||
name = "ilb-test"
|
name = "ilb-test"
|
||||||
project_id = var.project_id
|
project_id = var.project_id
|
||||||
region = "europe-west1"
|
region = var.region
|
||||||
backend_service_configs = {
|
backend_service_configs = {
|
||||||
default = {
|
default = {
|
||||||
backends = [{
|
backends = [{
|
||||||
group = "projects/myprj/zones/europe-west1-a/instanceGroups/my-ig"
|
group = module.compute-vm-group-b.group.id
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -575,14 +576,14 @@ module "ilb-l7" {
|
|||||||
}
|
}
|
||||||
service_attachment = {
|
service_attachment = {
|
||||||
nat_subnets = [var.subnet_psc_1.self_link]
|
nat_subnets = [var.subnet_psc_1.self_link]
|
||||||
automatic_connection = true
|
automatic_connection = false
|
||||||
consumer_accept_lists = {
|
consumer_accept_lists = {
|
||||||
# map of `project_id` => `connection_limit`
|
# map of `project_id` => `connection_limit`
|
||||||
(var.project_id) = 10
|
(var.project_id) = 10
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# tftest modules=1 resources=6
|
# tftest modules=3 resources=10 fixtures=fixtures/compute-vm-group-bc.tf e2e
|
||||||
```
|
```
|
||||||
|
|
||||||
### Complex example
|
### Complex example
|
||||||
@@ -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. | |
|
| [psc_neg_ids](outputs.tf#L68) | Autogenerated PSC network endpoint group ids. | |
|
||||||
| [regional_neg_ids](outputs.tf#L75) | Autogenerated regional 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. | |
|
| [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 -->
|
<!-- END TFDOC -->
|
||||||
|
|||||||
@@ -219,6 +219,11 @@ resource "google_compute_region_network_endpoint_group" "psc" {
|
|||||||
psc_target_service = each.value.psc.target_service
|
psc_target_service = each.value.psc.target_service
|
||||||
network = each.value.psc.network
|
network = each.value.psc.network
|
||||||
subnetwork = each.value.psc.subnetwork
|
subnetwork = each.value.psc.subnetwork
|
||||||
|
lifecycle {
|
||||||
|
# ignore until https://github.com/hashicorp/terraform-provider-google/issues/20576 is fixed
|
||||||
|
ignore_changes = [psc_data]
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
locals {
|
locals {
|
||||||
|
|||||||
@@ -121,6 +121,10 @@ resource "google_compute_region_network_endpoint_group" "psc" {
|
|||||||
psc_target_service = each.value.psc.target_service
|
psc_target_service = each.value.psc.target_service
|
||||||
network = each.value.psc.network
|
network = each.value.psc.network
|
||||||
subnetwork = each.value.psc.subnetwork
|
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
|
# Internet NEG
|
||||||
|
|||||||
Reference in New Issue
Block a user