Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 AlloyDB user support #8431
Add AlloyDB user support #8431
Changes from 6 commits
bfb1644
1d63878
c090453
92a1a1c
350325c
7db7e17
7981267
44fa955
5e3592a
eda0326
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Is it preferable to have this set up as a single parent resource rather than a series of project/location/cluster?
Generally we have each broken out into an individual field.
cc @GauravJain21
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.
That would mean that the user has to set it's location and I'd argue this resource isn't a regional object on it's own but rather part of a regional object.
As the cluster dictates what region the user resides in I wouldn't give the user the option to specify location.
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.
True. On the other hand existing resources like
google_sql_user
work this way, where the project and instance are both specified independently: https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/sql_user#projectThere 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.
The biggest difference here is that
google_sql_user
doesn't rely on a region in his end-point nor is it a field that can be set.It is implied that it lives in the region where the instance resides in.
POST https://sqladmin.googleapis.com/v1/projects/{project}/instances/{instance}/users
I am curious what others believe the right approach is here.
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.
This should change to a parameterized value so it gets a random suffix attached. Right now this is causing the failure because it collides with another network named the same
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.
@slevenick I am skipping the generation of tests because this particular resource does not work well with the autogenerated tests.
If we destroy the cluster or instance during the CheckDestroy phase that will result in Internal 500 errors when trying to verify if an user still exists, therefore I need to check it while the parent resource still exists.
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.
That's.... frightening. What do we expect the user experience to be when they created a user within Terraform and then they destroyed it via another tool? They would hit the 500 and be confused about what is happening
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.
Can you share either the error message in logs or a use case that triggers it? I can reach out to the internal team because returning a 500 on an attempted GET is pretty bad.
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.
@slevenick I did not realise the impact in certain scenario's on users and didn't report it, for future contributions I will keep this in mind.
There are a few scenario's where this can happens but usually boils down to not having an instance in it's cluster.
I tested the following 2 scenario's:
You create a cluster and try to add an user without creating an instance.
You create a cluster, instance & user through Terraform and we delete the instance and try to pull the state of the user resource
While I was at it I tested what happens with an invalid cluster name and it got rejected as a 404.
Given these results I am unsure if this should be merged at this time.
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.
@GauravJain21 please take a look at this