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

Allow setting SqlServerUserDetails from google_sql_user resource #6016

Merged
merged 10 commits into from
Jun 6, 2022

Conversation

jseriff
Copy link
Contributor

@jseriff jseriff commented May 6, 2022

Allow setting SqlServerUserDetails from google_sql_user resource

This is a lift of hashicorp/terraform-provider-google#11342 into the magic modules repo.

Resolves hashicorp/terraform-provider-google#10438

If this PR is for Terraform, I acknowledge that I have:

  • Searched through the issue tracker for an open issue that this either resolves or contributes to, commented on it to claim it, and written "fixes {url}" or "part of {url}" in this PR description. If there were no relevant open issues, I opened one and commented that I would like to work on it (not necessary for very small changes).
  • Generated Terraform, and ran make test and make lint to ensure it passes unit and linter tests.
  • Ensured that all new fields I added that can be set by a user appear in at least one example (for generated resources) or third_party test (for handwritten resources or update tests).
  • Ran relevant acceptance tests (If the acceptance tests do not yet pass or you are unable to run them, please let your reviewer know).
  • Read the Release Notes Guide before writing my release note below.

Release Note Template for Downstream PRs (will be copied)

sql: added `sql_server_user_details` field to `google_sql_user` resource

@google-cla
Copy link

google-cla bot commented May 6, 2022

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

For more information, open the CLA check for this pull request.

@modular-magician
Copy link
Collaborator

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

I've detected that you're a community contributor. @rileykarson, a repository maintainer, has been assigned to assist you and help review your changes.

❓ First time contributing? Click here for more details

Your assigned reviewer will help review your code by:

  • Ensuring it's backwards compatible, covers common error cases, etc.
  • Summarizing the change into a user-facing changelog note.
  • Passes tests, either our "VCR" suite, a set of presubmit tests, or with manual test runs.

You can help make sure that review is quick by running local tests and ensuring they're passing in between each push you make to your PR's branch. Also, try to leave a comment with each push you make, as pushes generally don't generate emails.

If your reviewer doesn't get back to you within a week after your most recent change, please feel free to leave a comment on the issue asking them to take a look! In the absence of a dedicated review dashboard most maintainers manage their pending reviews through email, and those will sometimes get lost in their inbox.


@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 2 files changed, 32 insertions(+))
Terraform Beta: Diff ( 2 files changed, 32 insertions(+))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

The provider crashed while running the VCR tests in REPLAYING mode
Please fix it to complete your PR
View the build log

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 2 files changed, 32 insertions(+))
Terraform Beta: Diff ( 2 files changed, 32 insertions(+))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 2 files changed, 32 insertions(+))
Terraform Beta: Diff ( 2 files changed, 32 insertions(+))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

The provider crashed while running the VCR tests in REPLAYING mode
Please fix it to complete your PR
View the build log

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 2 files changed, 32 insertions(+))
Terraform Beta: Diff ( 2 files changed, 32 insertions(+))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 2 files changed, 64 insertions(+))
Terraform Beta: Diff ( 2 files changed, 64 insertions(+))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

The provider crashed while running the VCR tests in REPLAYING mode
Please fix it to complete your PR
View the build log

@jseriff
Copy link
Contributor Author

jseriff commented May 10, 2022

I believe this is ready to go, although I cannot see why the VCR-test is failing, and if that is related to my change or not. Let me know if anything else is needed.

@jseriff jseriff requested a review from rileykarson May 16, 2022 14:13
@rileykarson
Copy link
Member

Sorry for the delay in getting back! Here's the failure:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x2c852ee]

goroutine 111686 [running]:
github.com/hashicorp/terraform-provider-google-beta/google-beta.resourceSqlUserRead(0xc0242c3080, 0x3a77920, 0xc016df2000, 0xc00004a06f, 0x16)
	/go/src/github.com/hashicorp/terraform-provider-google-beta/google-beta/resource_sql_user.go:278 +0xb4e
github.com/hashicorp/terraform-provider-google-beta/google-beta.resourceSqlUserCreate(0xc0242c3080, 0x3a77920, 0xc016df2000, 0x0, 0x0)
	/go/src/github.com/hashicorp/terraform-provider-google-beta/google-beta/resource_sql_user.go:206 +0xca5
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xc00d4b0e00, 0x4295090, 0xc01868a800, 0xc0242c3080, 0x3a77920, 0xc016df2000, 0x0, 0x0, 0x0)
	/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:329 +0x1ee
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc00d4b0e00, 0x4295090, 0xc01868a800, 0xc019070750, 0xc0242c2f00, 0x3a77920, 0xc016df2000, 0x0, 0x0, 0x0, ...)
	/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:467 +0x67b
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc002fda1f8, 0x4295090, 0xc01868a800, 0xc015820be0, 0x3abac0b, 0x12, 0x0)
	/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:977 +0xacf
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc021cea880, 0x4295138, 0xc01868a800, 0xc01796a2a0, 0x0, 0x0, 0x0)
	/go/pkg/mod/github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:603 +0x465
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler(0x39f2f40, 0xc021cea880, 0x4295138, 0xc01b3670b0, 0xc01b044a80, 0x0, 0x4295138, 0xc01b3670b0, 0xc008bbc3c0, 0x1d1)
	/go/pkg/mod/github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:380 +0x214
google.golang.org/grpc.(*Server).processUnaryRPC(0xc01cf82e00, 0x42dac58, 0xc00852a1a0, 0xc0158065a0, 0xc01bce0e70, 0x56e5700, 0x0, 0x0, 0x0)
	/go/pkg/mod/google.golang.org/[email protected]/server.go:1282 +0x52b
google.golang.org/grpc.(*Server).handleStream(0xc01cf82e00, 0x42dac58, 0xc00852a1a0, 0xc0158065a0, 0x0)
	/go/pkg/mod/google.golang.org/[email protected]/server.go:1616 +0xd0c
google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc010921720, 0xc01cf82e00, 0x42dac58, 0xc00852a1a0, 0xc0158065a0)
	/go/pkg/mod/google.golang.org/[email protected]/server.go:921 +0xab
created by google.golang.org/grpc.(*Server).serveStreams.func1
	/go/pkg/mod/google.golang.org/[email protected]/server.go:919 +0x1fd
FAIL	github.com/hashicorp/terraform-provider-google-beta/google-beta	854.319s
FAIL

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 5 files changed, 74 insertions(+), 8 deletions(-))
Terraform Beta: Diff ( 6 files changed, 80 insertions(+), 14 deletions(-))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2019
Passed tests 1787
Skipped tests: 231
Failed tests: 1

Action taken

Triggering VCR tests in RECORDING mode for the following tests that failed during VCR: TestAccCloudAssetFolderFeed_cloudAssetFolderFeedExample

@modular-magician
Copy link
Collaborator

Tests failed during RECORDING mode:
TestAccCloudAssetFolderFeed_cloudAssetFolderFeedExample[view]

Please fix these to complete your PR
View the build log or the debug log for each test

@jseriff
Copy link
Contributor Author

jseriff commented May 18, 2022

Resolved that issue, i believe - another test failed, but i cannot see the output. Please advise

@rileykarson
Copy link
Member

That one's just noise!

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 4 files changed, 116 insertions(+), 12 deletions(-))
Terraform Beta: Diff ( 4 files changed, 114 insertions(+), 10 deletions(-))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2020
Passed tests 1787
Skipped tests: 232
Failed tests: 1

Action taken

Triggering VCR tests in RECORDING mode for the following tests that failed during VCR: TestAccCloudAssetFolderFeed_cloudAssetFolderFeedExample

@modular-magician
Copy link
Collaborator

Tests failed during RECORDING mode:
TestAccCloudAssetFolderFeed_cloudAssetFolderFeedExample[view]

Please fix these to complete your PR
View the build log or the debug log for each test

@jseriff jseriff requested a review from rileykarson May 18, 2022 21:11
@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 4 files changed, 112 insertions(+), 10 deletions(-))
Terraform Beta: Diff ( 4 files changed, 112 insertions(+), 10 deletions(-))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2020
Passed tests 1786
Skipped tests: 231
Failed tests: 3

Action taken

Triggering VCR tests in RECORDING mode for the following tests that failed during VCR: TestAccFirebaserulesRelease_BasicRelease|TestAccCloudAssetFolderFeed_cloudAssetFolderFeedExample|TestAccSqlUser_mysqlDisabled

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccFirebaserulesRelease_BasicRelease[view]

Tests failed during RECORDING mode:
TestAccCloudAssetFolderFeed_cloudAssetFolderFeedExample[view]
TestAccSqlUser_mysqlDisabled[view]

Please fix these to complete your PR
View the build log or the debug log for each test

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 2 files changed, 103 insertions(+), 4 deletions(-))
Terraform Beta: Diff ( 2 files changed, 103 insertions(+), 4 deletions(-))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2023
Passed tests 1789
Skipped tests: 231
Failed tests: 3

Action taken

Triggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed tests TestAccEventarcTrigger_BasicHandWritten|TestAccIAM2DenyPolicy_iamDenyPolicyBasicExample|TestAccSqlUser_mysqlDisabled

@jseriff jseriff requested a review from rileykarson May 23, 2022 20:23
@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccSqlUser_mysqlDisabled[view]
TestAccIAM2DenyPolicy_iamDenyPolicyBasicExample[view]

Tests failed during RECORDING mode:
TestAccEventarcTrigger_BasicHandWritten[view]

Please fix these to complete your PR
View the build log or the debug log for each test

@jseriff
Copy link
Contributor Author

jseriff commented Jun 6, 2022

I believe the only remaining failure is unrelated to this change, is it possible to get this merged, so we can use workload identity via terraform?

@rileykarson
Copy link
Member

LGTM, yep! Sorry for the delay in getting back, been pretty underwater in reviews.

@k-mckinney
Copy link

@rileykarson - I noticed on the terraform provider docs page that it doesn't mention the sql_server_user_details block added by this PR.

Is that documentation managed here, and is that manually maintained? Just curious if another PR to update the documentation would be in order?

@rileykarson
Copy link
Member

Yeah, we'd need to manually change that page. I missed that in the initial review! For most resources it's automated these days.

@dmead
Copy link

dmead commented Jan 30, 2023

Hey just chiming in here that sql_server_user_details would be super useful if it wasn't read only and actually documented.

i'm imported a database dump from gcloud alpha sql import sql and the role assigned to the imported databae/schemas doesn't align with whats being given to IAM service accounts with google_sql_user

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.

Add support for roles in google_sql_user
5 participants