-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Provider Oneandone #13633
Provider Oneandone #13633
Conversation
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.
Hi @jasminSPC
Ran through the first couple of resources and found the same issues in both
Can you have a look and see if you can roll the same changes across all of the resources?
Thanks
Paul
Optional: true, | ||
Default: 50, | ||
}, | ||
"endpoint": { |
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 think it would be good to be able to allow this to be set via ENV VAR as well
"retries": { | ||
Type: schema.TypeInt, | ||
Optional: true, | ||
Default: 50, |
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.
Also ENV VAR would be a good addition
} | ||
config := Config{ | ||
Token: d.Get("token").(string), | ||
Retries: d.Get("retries").(int), |
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.
Retries are passed to the Config
struct but not actually used in there?
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.
"retries" are not used in provider.go
but are used pretty much in every 1and1 resource.
"port_from": { | ||
Type: schema.TypeInt, | ||
Optional: true, | ||
ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) { |
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.
There is a new func that you can use as part of the helpers package:
validation.IntBetween(1, 65535),
it lives in the github.com/hashicorp/terraform/helper/validation
package
return err | ||
} | ||
|
||
config.API.WaitForState(fw, "ACTIVE", 10, config.Retries) |
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.
You are waiting for state twice
} | ||
|
||
if raw, ok := d.GetOk("persistence"); ok { | ||
req.Persistence = oneandone.Bool2Pointer(raw.(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.
love the wrappers :)
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 I remove it?
func resourceOneandOneLoadbalancerUpdate(d *schema.ResourceData, meta interface{}) error { | ||
config := meta.(*Config) | ||
|
||
if d.HasChange("name") || d.HasChange("description") || d.HasChange("method") || d.HasChange("persistence") || d.HasChange("persistence_time") || d.HasChange("health_check_test") || d.HasChange("healt_check_interval") { |
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.
typo on health_check_interval
oldR, newR := d.GetChange("rules") | ||
oldValues := oldR.([]interface{}) | ||
newValues := newR.([]interface{}) | ||
if len(oldValues) > len(newValues) { |
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.
Again questioning if this is valid logic...
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.
Added acceptance test for the scenario
"time" | ||
) | ||
|
||
func TestAccOneandoneLoadbalancer_Basic(t *testing.T) { |
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.
Would love to see a test for Import
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.
Import is not implemented
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 removed ImportStatePassthrough
Type: schema.TypeString, | ||
Optional: true, | ||
}, | ||
"method": { |
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.
Do we need to check the valid values or the casing of this?
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.
Added validation for two known methods
Hi @stack72 , I've addressed all remarks as requested |
This test: TestAccOneandonePrivateNetwork_Basic doesn't finish for me - has been running for like 30 mins Also, the website doesn't have the link to the provider docs |
Here are the docs https://cloudpanel-api.1and1.com/documentation/v1/en/documentation.html |
@stack72 I was able to speed it up a little by using different server image
I'm going to push the changes |
|
One test issue that @jasminSPC is working on but this is good to go! I am going to merge and he is going to follow up with a test fix Paul |
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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
This is a provider for 1&1.
Cloud Server API documentation is here
This provider manages following 1&1 resources:
For credentials for acceptance tests please contact me on via email.