-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Add subnetwork secondary ip ranges beta feature #310
Conversation
@@ -68,6 +77,26 @@ func resourceComputeSubnetwork() *schema.Resource { | |||
Optional: true, | |||
}, | |||
|
|||
"secondary_ip_range": &schema.Schema{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if it will ever make a difference, but this should probably be marked ForceNew
as well as it's children.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
LGTM 👍, not sure if we should get another reviewer or not here
I'll follow up with another PR cleaning up Beta operations after this. |
I added @danawillow to have another pair of eyes looking at this PR. |
@@ -256,3 +333,41 @@ func resourceComputeSubnetworkImportState(d *schema.ResourceData, meta interface | |||
|
|||
return []*schema.ResourceData{d}, nil | |||
} | |||
|
|||
func createBetaSubnetID(s *computeBeta.Subnetwork) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and createSubnetID
should probably live in the same file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved createSubnetID
to resource_compute_subnetwork.go
google/self_link_helpers.go
Outdated
@@ -28,6 +28,17 @@ func compareSelfLinkRelativePaths(k, old, new string, d *schema.ResourceData) bo | |||
return false | |||
} | |||
|
|||
// This method should only be used if the self link references a global resource. | |||
func compareSelfLinkResourceNames(k, old, new string, d *schema.ResourceData) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait I'm confused why compareSelfLinkRelativePaths
doesn't work on global resources.
Network self links look like https://www.googleapis.com/compute/v1/projects/project/global/networks/network, so comparing the relative one would be comparing project/global/networks/network
which should work just fine, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The network
field can be a self_link
or the name of the network.
This method works when the field can be either name
or self_link
.
If we were using compareSelfLinkRelativePaths
, then we would get a diff if we specify the network using its name in the config.
mynetwork != project/global/networks/mynetwork
I updated the comment to make it clearer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the function also be renamed since it's not necessarily comparing self links?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about compareGlobalSelfLinkOrResourceName
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed.
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
Fixes #287
peer-programmed w/ @rileykarson on this PR.
cc/ @danawillow