-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add charset and collation to google_sql_database. #183
Conversation
Added a trivial acceptance test. Happy to improve, please advise. $ gmake testacc GOOGLE_USE_DEFAULT_CREDENTIALS=1 GOOGLE_PROJECT=ubschmidt GOOGLE_REGION=us-central1 GOOGLE_XPN_HOST_PROJECT=a TEST=./google TESTARGS='-run=TestAccGoogleSqlDatabase_basic' |
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.
Thanks for the changes!
I left a few comments - they're all pretty minor, just moving a few things around and fleshing out the example in the docs with your new fields.
google/resource_sql_database.go
Outdated
@@ -62,6 +75,14 @@ func resourceSqlDatabaseCreate(d *schema.ResourceData, meta interface{}) error { | |||
Instance: instance_name, | |||
} | |||
|
|||
if v, ok := d.GetOk("charset"); ok { |
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.
Since we have a default set, we should always get a value from this; we can change both values from d.GetOk
to d.Get
. We can also inline these values into the struct initializer of db
.
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.
Done.
google/resource_sql_database.go
Outdated
Instance: instance_name, | ||
} | ||
|
||
if v, ok := d.GetOk("charset"); ok { |
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.
Same as above - we will always have a value present, so we can use d.Get
instead of d.GetOk
, and inline these into db
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.
Done.
"google_sql_database.database", &database), | ||
), | ||
}, | ||
resource.TestStep{ |
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.
Let's split the charset and collation parts into their own test and leave _basic
as a single-step test; that way, we can keep the testing for Update
out of _basic
.
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.
Done.
@@ -37,6 +37,10 @@ The following arguments are supported: | |||
|
|||
* `instance` - (Required) The name of containing instance. | |||
|
|||
* `charset` - (Optional) The MySQL charset value. |
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.
Nit: These entries should live under the horizontal divider with other optional fields.
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.
Done.
@@ -37,6 +37,10 @@ The following arguments are supported: | |||
|
|||
* `instance` - (Required) The name of containing instance. | |||
|
|||
* `charset` - (Optional) The MySQL charset value. |
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 you mind adding the charset
and collation
fields to the example at the top of the page? (Apologies for commenting here - Github doesn't like comments on unchanged lines)
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.
Done. Also documented defaults in argument reference.
Thanks for the review! |
LGTM, thanks!
|
* Add charset and collation to google_sql_database. * Add documentation for charset, collation attributes. * Extend the existing acceptance test to also cover charset and collation. * Charset and collation always have a value present. Also inline. * Move charset and collation to optional arguments. * Add charset and collection to the example. * Document charset and collation defaults. * Keep TestAccGoogleSqlDatabase_basic as is, add TestAccGoogleSqlDatabase_update.
* Add charset and collation to google_sql_database. * Add documentation for charset, collation attributes. * Extend the existing acceptance test to also cover charset and collation. * Charset and collation always have a value present. Also inline. * Move charset and collation to optional arguments. * Add charset and collection to the example. * Document charset and collation defaults. * Keep TestAccGoogleSqlDatabase_basic as is, add TestAccGoogleSqlDatabase_update.
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! |
Fixes #179.