Open philip-harvey opened 1 year ago
Also tested with an older version of the provider and the same result
Found the trigger for this, in the NE port is listed as optional, but if it's omitted then the provider errors. If you specify the port then it works. e.g.
resource "google_compute_network_endpoint" "test" {
network_endpoint_group = google_compute_network_endpoint_group.test-neg.name
instance = google_compute_instance.test.name
ip_address = google_compute_instance.test.network_interface[0].network_ip
port = google_compute_network_endpoint_group.test-neg.default_port
zone = var.compute_zones.0
}
Noticed that Terraform 1.4 came out today, re-tested and same result.
I see where the problem is. This happens when port is not provided in the google_compute_network_endpoint
To workaround, please provide port
explicitly until a fix is in place
Looks like port should be required if used with an external network endpoint group, but must not be required if using an internal group per https://github.com/GoogleCloudPlatform/magic-modules/pull/6373
I'll do some testing to verify that, but if it's the case this might be tricky to solve
Looks like port should be required if used with an external network endpoint group, but must not be required if using an internal group per GoogleCloudPlatform/magic-modules#6373
I'll do some testing to verify that, but if it's the case this might be tricky to solve
Thanks for looking into this. I guess a documentation update could at least clarify this
Unfortunately I don't think there is a good solution here.
I think the right solution may be to have two separate resources, one which requires port and one which does not allow specifying port and each can correspond to an endpoint on a different type of NEG.
I'm marking this as persistent & breaking change because we can't introduce a requirement on the port field at this point, and we can't tell what type the NEG is from within the network endpoint.
If we had access to the NEG we could enforce that port is set when needed, but as separate Terraform resources we can't tell that
Can we at least document that port is required for external NEGs in the documentation? It took several hours to figure that out since the error messages didn't point to the issue
Community Note
modular-magician
user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned tohashibot
, a community member has claimed the issue already.Terraform Version
Terraform v1.3.9 Google v4.56.0
Affected Resource(s)
google_compute_network_endpoint
Terraform Configuration Files
Debug Output
google_compute_network_endpoint.test: Creating... google_compute_network_endpoint.test: Still creating... [10s elapsed] β· β Error: Provider produced inconsistent result after apply β β When applying changes to google_compute_network_endpoint.test, provider "provider[\"registry.terraform.io/hashicorp/google\"]" produced an unexpected new value: Root resource was present, but now absent. β β This is a bug in the provider, which should be reported in the provider's own issue tracker.
Expected Behavior
NE is created
Actual Behavior
NE is created but terraform errors out and doesn't add it to the state file
Steps to Reproduce
terraform init
terraform apply
Important Factoids
Tested with a shared VPC.
b/317497554