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

adds ovh_iploadbalancing_tcp_farm_server resource #33

Merged
merged 1 commit into from
May 28, 2018

Conversation

goblain
Copy link
Contributor

@goblain goblain commented May 21, 2018

This commit introduces ovh_iploadbalancing_tcp_farm_server.

@goblain goblain force-pushed the iploadbalancing_tcp_farm_server branch from dc56680 to 8647b4d Compare May 22, 2018 11:25
@yanndegat
Copy link
Collaborator

hi @goblain

regarding the ovh_ip_server;
couldn't we use an ip from a private ipv4 range instead ? such as 192.168.0.1 ? or 10.0.0.10 ?
as we will add a "vrack enabled" iplb, it shouldnt be rejected by the API

@goblain goblain force-pushed the iploadbalancing_tcp_farm_server branch from 8647b4d to 6f7a6ef Compare May 22, 2018 16:27
@goblain
Copy link
Contributor Author

goblain commented May 22, 2018

using private IP seems to yield satisfying result, so indeed no need for this env

@goblain goblain force-pushed the iploadbalancing_tcp_farm_server branch from 6f7a6ef to 03a808f Compare May 23, 2018 07:36
@goblain goblain changed the title [do not merge] adds ovh_iploadbalancing_tcp_farm_server resource adds ovh_iploadbalancing_tcp_farm_server resource May 23, 2018
@goblain goblain force-pushed the iploadbalancing_tcp_farm_server branch 2 times, most recently from 7eaae55 to 3a3a775 Compare May 23, 2018 09:00
config := meta.(*Config)

newBackendServer := &IpLoadbalancingTcpFarmServer{
DisplayName: getNilStringPointer(d.Get("display_name").(string)),
Copy link
Collaborator

Choose a reason for hiding this comment

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

i don't see the use of "getNilStringPointer"

AFAIK, there's no such thing elswhere in terraform providers. what are we trying to do here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

assuming "display_name" is not set, d.Get("display_name").(string) returns an empty string "", but a string none the less. gos json.Marshal method correctly interprets it as an empty string rather then a not set string. This is why the struct uses pointers instead of string values, so they can have nil value. getNilStringPointer then gets the string value and turns it into a pointer to string value, that in case of len(<string>) == 0 returns nil, so that json.Marshal() instead of generating "displayName": "" generates "displayName": null which OVH API expects (ie. it will complain if you will have a zero value field instead of null for attributes that can not be changed after resource creation

Copy link
Collaborator

Choose a reason for hiding this comment

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

have you tried with d.Get("display_name").(*string) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in fact I did :) it did not work. Don't think type assertion is meant to work like that at all, and even if it did, it would have no way to distinct between nil and zero value, so instead of recovering nil, it would recover *"" but as I said, it's not doing even that.

Copy link
Contributor Author

@goblain goblain May 25, 2018

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.

ok then

@yanndegat
Copy link
Collaborator

could you rebase the provider so we can merge this PR ?

@goblain goblain force-pushed the iploadbalancing_tcp_farm_server branch from 3a3a775 to e12270c Compare May 26, 2018 21:30
@goblain goblain force-pushed the iploadbalancing_tcp_farm_server branch from e12270c to 8c5dfb4 Compare May 26, 2018 21:40
@goblain
Copy link
Contributor Author

goblain commented May 26, 2018

rebased

@yanndegat yanndegat merged commit 4631eb4 into ovh:master May 28, 2018
@yanndegat
Copy link
Collaborator

once again, thanks a lot @goblain

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants