-
Notifications
You must be signed in to change notification settings - Fork 9.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
provider/clc: Fix clc_server password argument as Optional. #6414
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,15 +44,14 @@ func resourceCLCServer() *schema.Resource { | |
Type: schema.TypeInt, | ||
Required: true, | ||
}, | ||
// optional | ||
"password": &schema.Schema{ | ||
Type: schema.TypeString, | ||
Required: true, | ||
Optional: true, | ||
}, | ||
// optional | ||
"description": &schema.Schema{ | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Default: "", | ||
}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is the Default "" removed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See comment on line 50... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you should add Computed: true as well, since it can be generated by the platform. Similar to what is done for "private_ip_address." |
||
"type": &schema.Schema{ | ||
Type: schema.TypeString, | ||
|
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.
As the code now makes this optional, we need to change the
func resourceCLCServerCreate(d *schema.ResourceData, meta interface{}) error {
func so that we only pass a password if it is supplied. Right now, the Create will supply a null valueThere 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.
@stack72 I was under the impression that the
d.Get("password").(string)
on line 125 will return""
if not provided...That's based on: https://github.com/hashicorp/terraform/blob/master/helper/schema/resource_data.go#L48-L60
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.
To add, the clc-sdk will omit [1] an empty password.
[1] https://github.com/CenturyLinkCloud/clc-sdk/blob/master/server/server.go#L327