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

google_compute_network_endpoint_group datasource is returning error if the NEG doesn't exist #17947

Closed
than-pet opened this issue Apr 24, 2024 · 2 comments

Comments

@than-pet
Copy link

than-pet commented Apr 24, 2024

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to a user, that user is claiming responsibility for the issue.
  • Customers working with a Google Technical Account Manager or Customer Engineer can ask them to reach out internally to expedite investigation and resolution of this issue.

Terraform Version

Terraform v1.7.5
on darwin_arm64

  • provider registry.terraform.io/hashicorp/google v5.0.0

Affected Resource(s)

datasource google_compute_network_endpoint_group

Terraform Configuration

data "google_compute_network_endpoint_group" "this" {
  name = "not-existing-neg"
  zone = "europe-west2-a"
}

output "network_endpoint_group" {
  value = data.google_compute_network_endpoint_group.this
}

Debug Output

Planning failed. Terraform encountered an error while generating this plan.


│ Error: projects/my-project/zones/europe-west2-a/networkEndpointGroups/not-existing-neg not found

│ with data.google_compute_network_endpoint_group.this,
│ on test.tf line 20, in data "google_compute_network_endpoint_group" "this":
│ 20: data "google_compute_network_endpoint_group" "this" {

Expected Behavior

Return an object with null values if the NEG doesn't exist

Changes to Outputs:
  + network_endpoint_group = {
      + default_port          = null
      + description           = null
      + id                    = null
      + name                  = null
      + network               = null
      + network_endpoint_type = null
      + project               = null
      + self_link             = null
      + size                  = null
      + subnetwork            = null
      + zone                  = null
    }

That was the behavior before v5.0.0 (tested with v4.84.0)

Actual Behavior

Plan fails if the NEG is not found in the google project after v5.0.0+

Steps to reproduce

  1. use a NEG name that doesn't exist
  2. terraform apply

Important Factoids

No response

References

No response

b/337926216

@than-pet than-pet added the bug label Apr 24, 2024
@github-actions github-actions bot added forward/review In review; remove label to forward service/compute-networking-neg labels Apr 24, 2024
@ggtisc ggtisc self-assigned this Apr 29, 2024
@ggtisc
Copy link
Collaborator

ggtisc commented Apr 29, 2024

Confirmed scenario.

It is possible to create the resource with the shared terraform configuration, but only with version 4.84.0, for now it is not available for the current version. This could be an enhancement for the future.

@ggtisc ggtisc added enhancement and removed bug forward/review In review; remove label to forward labels Apr 29, 2024
@BBBmau
Copy link
Contributor

BBBmau commented May 6, 2024

This change is intentional, see the upgrade guide here.

@BBBmau BBBmau closed this as completed May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants