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

provider/clc: Fix clc_server password argument as Optional. #6414

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions builtin/providers/clc/resource_clc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,14 @@ func resourceCLCServer() *schema.Resource {
Type: schema.TypeInt,
Required: true,
},
// optional
"password": &schema.Schema{
Type: schema.TypeString,
Required: true,
Optional: true,
Copy link
Contributor

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 value

Copy link
Contributor Author

@fatmcgav fatmcgav Apr 29, 2016

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

Copy link
Contributor Author

@fatmcgav fatmcgav Apr 29, 2016

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

},
// optional
"description": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Default: "",
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is the Default "" removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See comment on line 50...

Choose a reason for hiding this comment

The 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,
Expand Down