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

New Resource: MariaDB #2406

Merged
merged 33 commits into from Dec 4, 2018
Merged

New Resource: MariaDB #2406

merged 33 commits into from Dec 4, 2018

Conversation

WodansSon
Copy link
Collaborator

@WodansSon WodansSon commented Nov 29, 2018

Added support for the new MariaDB

fixes #2044

Copy link
Member

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

hey @jeffreyCline

I've taken a look through and left some minor comments in line but on the whole this looks pretty good - if we can fix those up this otherwise should be good to merge 👍

Thanks!

"MO_Gen5_8",
"MO_Gen5_16",
}, true),
DiffSuppressFunc: suppress.CaseDifference,
Copy link
Member

Choose a reason for hiding this comment

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

since this is a new resource can we make this case sensitive?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

string(mariadb.GeneralPurpose),
string(mariadb.MemoryOptimized),
}, true),
DiffSuppressFunc: suppress.CaseDifference,
Copy link
Member

Choose a reason for hiding this comment

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

(same here) can we make this case sensitive?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

string(mariadb.Enabled),
string(mariadb.Disabled),
}, true),
DiffSuppressFunc: suppress.CaseDifference,
Copy link
Member

Choose a reason for hiding this comment

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

(same here)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

string(mariadb.SslEnforcementEnumDisabled),
string(mariadb.SslEnforcementEnumEnabled),
}, true),
DiffSuppressFunc: suppress.CaseDifference,
Copy link
Member

Choose a reason for hiding this comment

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

(and here)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

tier, _ := diff.GetOk("sku.0.tier")
storageMB, _ := diff.GetOk("storage_profile.0.storage_mb")

if strings.ToLower(tier.(string)) == "basic" && storageMB.(int) > 1048576 {
Copy link
Member

Choose a reason for hiding this comment

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

both of these fields are likely to be interpolated, as such it's likely the values won't be resolved at this point (due to a known bug in customizeDiff) and these values would be nil, so there'd be a crash here - as such I think we'd be better to put this logic in the Create method for the moment, unfortunately

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for the heads up about customizeDiff, moved the validation to the create method.

website/docs/r/mariadb_server.html.markdown Outdated Show resolved Hide resolved

---

`sku` supports the following:
Copy link
Member

Choose a reason for hiding this comment

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

in some of the newer resources this has been updated to:

Suggested change
`sku` supports the following:
A `sku` block supports the following:

website/docs/r/mariadb_server.html.markdown Outdated Show resolved Hide resolved

# azurerm_mariadb_server

Manage a MariaDB Server.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Manage a MariaDB Server.
Manages a MariaDB Server.

website/docs/r/mariadb_server.html.markdown Show resolved Hide resolved
tombuildsstuff and others added 10 commits November 29, 2018 11:45
Co-Authored-By: jeffreyCline <jcline@microsoft.com>
Co-Authored-By: jeffreyCline <jcline@microsoft.com>
Co-Authored-By: jeffreyCline <jcline@microsoft.com>
Co-Authored-By: jeffreyCline <jcline@microsoft.com>
Co-Authored-By: jeffreyCline <jcline@microsoft.com>
Co-Authored-By: jeffreyCline <jcline@microsoft.com>
Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

Hi @jeffreyCline,

Thank you for the changes, i've taken a look through and left some mostly minor and stylistic comments.

The major issue is not accessing the response properties through the .Properties object after a nil check.

website/docs/r/mariadb_server.html.markdown Outdated Show resolved Hide resolved
azurerm/resource_arm_mariadb_server.go Show resolved Hide resolved
azurerm/resource_arm_mariadb_server.go Outdated Show resolved Hide resolved
azurerm/resource_arm_mariadb_server.go Outdated Show resolved Hide resolved
azurerm/resource_arm_mariadb_server.go Outdated Show resolved Hide resolved
}

err = future.WaitForCompletionRef(ctx, client.Client)
if err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Very minor, but these two lines could be merged too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated both.

}
}

func flattenMariaDbServerSku(resp *mariadb.Sku) []interface{} {
Copy link
Collaborator

Choose a reason for hiding this comment

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

minor, but should be be sku instead of resp?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed.

return []interface{}{values}
}

func flattenMariaDbStorageProfile(resp *mariadb.StorageProfile) []interface{} {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here, should this be storage or profile rather then resp?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed.


//

func testCheckAzureRMMariaDbServerExists(name string) resource.TestCheckFunc {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we rename name to resourceName to prevent the shadowing down below on line 245?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, good catch... didn't see that 😄

azurerm/resource_arm_mariadb_server_test.go Outdated Show resolved Hide resolved
katbyte and others added 5 commits November 30, 2018 11:30
Co-Authored-By: jeffreyCline <jcline@microsoft.com>
Co-Authored-By: jeffreyCline <jcline@microsoft.com>
Co-Authored-By: jeffreyCline <jcline@microsoft.com>
Co-Authored-By: jeffreyCline <jcline@microsoft.com>
Co-Authored-By: jeffreyCline <jcline@microsoft.com>
katbyte and others added 5 commits November 30, 2018 11:32
Co-Authored-By: jeffreyCline <jcline@microsoft.com>
Co-Authored-By: jeffreyCline <jcline@microsoft.com>
Co-Authored-By: jeffreyCline <jcline@microsoft.com>
Co-Authored-By: jeffreyCline <jcline@microsoft.com>
Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

@jeffreyCline,

Thanks for the updates, aside from one comment left inline LGTM 👍

}

if properties := resp.ServerProperties; properties != nil {
d.Set("administrator_login", properties.AdministratorLogin)

This comment was marked as outdated.

@katbyte
Copy link
Collaborator

katbyte commented Dec 4, 2018

LGTM 💯

Feel free to merge

@WodansSon
Copy link
Collaborator Author

image

@WodansSon WodansSon merged commit 378109b into master Dec 4, 2018
@WodansSon WodansSon deleted the nr-mariadb branch December 4, 2018 02:38
@ghost
Copy link

ghost commented Mar 5, 2019

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@hashicorp hashicorp locked and limited conversation to collaborators Mar 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New resource request: Azure Server for MariaDB
3 participants