Skip to content

Add support GCE_VM_IP type for network endpoint group #10638

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

Closed
wants to merge 1 commit into from

Conversation

irwanshofwan
Copy link

Please review this pull request, the pull request to support GCE_VM_IP type for network endpoint group.
So we can setup internal lb using NEG as backend using terraform.

@github-actions github-actions bot requested a review from melinath November 25, 2021 17:45
Copy link
Collaborator

@melinath melinath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@irwanshofwan thanks for your contribution! It looks like there are a few small things it would be great to address.

@@ -65,7 +65,7 @@ range).`,
},
"port": {
Type: schema.TypeInt,
Required: true,
Optional: true,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the docs it looks like "If not specified, the defaultPort for the network endpoint group will be used." Do you know if this means that this will be nil (but fall back to the network endpoint group's value) or if it will be set on creation to whatever the default is? In the latter case this would need to be computed as well as optional.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've try this changes to and I think any API bug in google, so as documentation if we set the Network Endpoint type as "GCE_VM_IP" we don't need port and will use default_port variable which set in Network Endpoint Group.

But In console, port input is required (Different with the docs).

The another thing when we implement the changes (modified provider) to infrastructure, the provider will set port to 0 and the network endpoint still created (it's diff with the spec of port which must greater than zero in console).
So we can conclude that GCP not filter the API when creation by API and have different behaviour with docs. The proven is when we want to destroy the resource via terraform, it will turns to error regarding zero port.

Here's the docs I refer to https://cloud.google.com/load-balancing/docs/negs/setting-up-zonal-negs

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay... I think this probably needs to be computed as well as optional.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're upstreaming this to magic-modules, you would want to use default_from_api: true to indicate that it should be optional & computed. I believe that marking it as computed will probably / hopefully resolve the issue you're seeing with a 0 port? It could also be a problem with Terraform not being able to tell the difference between nil and zero.

@@ -103,7 +103,7 @@ The following arguments are supported:
The instance must be in the same zone of network endpoint group.

* `port` -
(Required)
(Optional)
Port number of network endpoint.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should also include (from the API docs): If not specified, the defaultPort for the network endpoint group will be used.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition to the change specified above, this docs file also need to be updated to specify the new possible value of GCE_VM_IP.

@melinath melinath self-requested a review December 2, 2021 16:27
@melinath
Copy link
Collaborator

melinath commented Dec 2, 2021

It would be great to add this field to a test. It might be easier to make this change and add a test by contributing directly to https://github.com/GoogleCloudPlatform/magic-modules/

@irwanshofwan
Copy link
Author

It would be great to add this field to a test. It might be easier to make this change and add a test by contributing directly to https://github.com/GoogleCloudPlatform/magic-modules/

will look into this

Copy link
Collaborator

@melinath melinath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removing from my review queue pending the changes requested above

@melinath
Copy link
Collaborator

@irwanshofwan are you still working on this PR?

@melinath
Copy link
Collaborator

melinath commented Apr 8, 2022

Closing this PR for now.

@melinath melinath closed this Apr 8, 2022
@github-actions
Copy link

github-actions bot commented May 9, 2022

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants