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

Add support rootPassword property for MS SQL Server #2592

Conversation

kopachevsky
Copy link
Contributor

@kopachevsky kopachevsky commented Nov 6, 2019

Added root_password parameter required MS SQL Server instance creation, ignored MySQL and PostgreSQL

Fixes hashicorp/terraform-provider-google/issues/4776

`sql`: added `root_password` field to `google_sql_database_instance` resource

@modular-magician
Copy link
Collaborator

Hello! I am a robot who works on Magic Modules PRs.

I have detected that you are a community contributor, so your PR will be assigned to someone with a commit-bit on this repo for initial review. They will authorize it to run through our CI pipeline, which will generate downstream PRs.

Thanks for your contribution! A human will be with you soon.

@danawillow, please review this PR or find an appropriate assignee.

@kopachevsky kopachevsky force-pushed the fix/4776/sql-server-root-password branch 2 times, most recently from 36e080b to 63faeb3 Compare November 6, 2019 15:32
@danawillow
Copy link
Contributor

Hi @kopachevsky, I see that you've marked this as a draft. Can you please let me know when it's ready for review, or if there's anything you'd like help figuring out? Thanks!

@kopachevsky
Copy link
Contributor Author

Hi @kopachevsky, I see that you've marked this as a draft. Can you please let me know when it's ready for review, or if there's anything you'd like help figuring out? Thanks!

@danawillow I'm currently testing it with terraform module I'm working on, regarding help - can you clarify for me requirements to switch it to review state, I did not run any kind of integration testing and didn't add any unit tests, is it required?

@danawillow
Copy link
Contributor

Feel free to change it to the review state whenever you'd like me to take a look at it. A test would be great- you can take a look at our existing ones at https://github.com/GoogleCloudPlatform/magic-modules/blob/master/third_party/terraform/tests/resource_sql_database_instance_test.go.erb. We have some guidance on running tests at https://github.com/GoogleCloudPlatform/magic-modules#testing-your-changes.

@kopachevsky kopachevsky marked this pull request as ready for review November 8, 2019 07:17
@kopachevsky
Copy link
Contributor Author

@danawillow ready for review

@danawillow
Copy link
Contributor

Thanks! The code looks reasonable at a glance, but I'm going to hold off until there are tests. Sounds like that's blocked on https://github.com/GoogleCloudPlatform/magic-modules/issues/2641, so I commented there.

@morgante
Copy link

@kopachevsky Will you be able to add tests to this?

@kopachevsky
Copy link
Contributor Author

@kopachevsky Will you be able to add tests to this?
yes, checking

@kopachevsky kopachevsky force-pushed the fix/4776/sql-server-root-password branch 2 times, most recently from 295f765 to 6fd9d76 Compare November 22, 2019 10:36
@kopachevsky
Copy link
Contributor Author

@danawillow added test, it passed, ready for review again:)

@danawillow danawillow self-requested a review November 22, 2019 20:43
@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician, I work on Magic Modules.
I see that this PR has already had some downstream PRs generated. Any open downstreams are already updated to your most recent commit, 6fd9d76.

Pull request statuses

WARNING: The following files changed in commit 6fd9d76 may need corresponding changes in third_party/validator:

  • third_party/terraform/resources/resource_sql_database_instance.go

No diff detected in terraform-google-conversion.
No diff detected in Ansible.
No diff detected in Inspec.

New Pull Requests

I built this PR into one or more new PRs on other repositories, and when those are closed, this PR will also be merged and closed.
depends: hashicorp/terraform-provider-google-beta#1432
depends: hashicorp/terraform-provider-google#4983

Copy link
Contributor

@danawillow danawillow left a comment

Choose a reason for hiding this comment

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

Thanks @kopachevsky! Just a few comments.

{
ResourceName: "google_sql_database_instance.instance",
ImportState: true,
// ImportStateVerify check disabled as long root_password property not stored in state
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd recommend using an ImportStateVerifyIgnore instead of ImportStateVerify: false so we can at least check the other fields. I'd also mention that the field isn't returned from the API (since it is stored in state)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agreed, done

@@ -212,6 +212,8 @@ The following arguments are supported:

* `replica_configuration` - (Optional) The configuration for replication. The
configuration is detailed below.

* `root_password` - (Optional) Required for MS SQL Server, ignored MySQL and PostgreSQL.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* `root_password` - (Optional) Required for MS SQL Server, ignored MySQL and PostgreSQL.
* `root_password` - (Optional) Initial root password. Required for MS SQL Server, ignored by MySQL and PostgreSQL.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, added (Optional, Beta)

@@ -325,6 +325,13 @@ func resourceSqlDatabaseInstance() *schema.Resource {
ForceNew: true,
},

"root_password": {
Copy link
Contributor

Choose a reason for hiding this comment

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

Since SQL server in GCP is still in beta, I think we should put this property only in the beta provider. If you agree, then you'll want to change the file extension to .go.erb and add tags like the ones you'll find in https://github.com/GoogleCloudPlatform/magic-modules/blob/master/third_party/terraform/resources/resource_compute_network_peering.go.erb for example. Same thing applies for the test, and then you'll want to say that it's beta in the docs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, sure

@@ -212,6 +212,8 @@ The following arguments are supported:

* `replica_configuration` - (Optional) The configuration for replication. The
configuration is detailed below.

* `root_password` - (Optional) Required for MS SQL Server, ignored MySQL and PostgreSQL.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you also mention in database_version what the accepted MSSQL versions are?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure, I'll take those from discovery document

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@kopachevsky kopachevsky force-pushed the fix/4776/sql-server-root-password branch 3 times, most recently from 392e9d0 to 8d3cd8f Compare November 25, 2019 11:31
@kopachevsky
Copy link
Contributor Author

@danawillow thanks for review, applied changes to all comments, feel free to re-review

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician, I work on Magic Modules.
I see that this PR has already had some downstream PRs generated. Any open downstreams are already updated to your most recent commit, 1064818.

Pull request statuses

terraform-provider-google-beta already has an open PR.
No diff detected in terraform-google-conversion.
terraform-provider-google already has an open PR.
No diff detected in Ansible.
No diff detected in Inspec.

New Pull Requests

I didn't open any new pull requests because of this PR.

kopachevsky and others added 3 commits November 26, 2019 23:24
… SQL Server

Added root_password parameter required MS SQL Server instance creation, ignored MySQL and PostgreSQL.
Fix added both to beta and ga providers.

Fixes #hashicorp/terraform-provider-google/issues/4776
Tracked submodules are build/terraform-beta build/terraform-mapper build/terraform build/ansible build/inspec.
@goobysnack
Copy link

As this is no longer beta, can we get this merged into the non beta google provider please? I'm using provider version 2.20.2and am getting An argument named "root_password" is not expected here.

@danawillow
Copy link
Contributor

@goobysnack can you please file a new issue for that? That's the best way to get things on our team's radar. https://github.com/terraform-providers/terraform-provider-google/issues/new?template=enhancement.md

@danawillow
Copy link
Contributor

For what it's worth, any new features we add (adding a beta field to the GA provider counts as a new feature) will be in the 3.X series, so it would be worth it for you to upgrade so you can get new features and bugfixes.

@goobysnack
Copy link

Still happening on 3.11.0.

  • Downloading plugin for provider "google" (hashicorp/google) 3.11.0...

....resource "google_sql_database_instance" "master":
An argument named "root_password" is not expected here.

@danawillow
Copy link
Contributor

Looks like you're using the google provider; you'll want to use google-beta for ones that haven't reached the GA provider yet. As I mentioned in my above comment, to get it into the GA provider you'll want to file a new issue in the TPG issue tracker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support rootPassword property of google_sql_database_instance for SQL Server
6 participants