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

feat: add user resource #5

Merged
merged 2 commits into from
Jul 2, 2020
Merged

feat: add user resource #5

merged 2 commits into from
Jul 2, 2020

Conversation

malnick
Copy link
Contributor

@malnick malnick commented Jun 22, 2020

Adds the user resource.

@malnick malnick requested a review from talanknight June 22, 2020 22:58
@malnick malnick force-pushed the ICU-257 branch 4 times, most recently from 41bf6b8 to b220dbf Compare June 22, 2020 23:11

u := convertResourceDataToUser(d)

if d.HasChange(userNameKey) {
Copy link
Contributor

Choose a reason for hiding this comment

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

For both name and description, check to see if d.Get(userNameKey) returns an empty string and if so set the u.SetDefault("user_name") and u.SetDefault("description") in those cases. This will allow these fields to be unset completely instead of being set to an empty 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.

What do you want to set them to if they're an empty string?

fooUserDescriptionUpdate = "foo bar"
)

var (
Copy link
Contributor

Choose a reason for hiding this comment

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

consider adding a test for updating a field to be unset.

@@ -26,6 +26,7 @@ func New() terraform.ResourceProvider {
ResourcesMap: map[string]*schema.Resource{
"watchtower_project": resourceProject(),
"watchtower_host_catalog": resourceHostCatalog(),
"watchtower_user": resourceUser(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider reordering these keys to be sorted lexicographically to make it easier to track down the resources as this list grows larger.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed :)

@malnick malnick merged commit 7b947a8 into master Jul 2, 2020
@malnick malnick deleted the ICU-257 branch July 2, 2020 21:19
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