-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
App check debug token #9930
App check debug token #9930
Conversation
Hello! I am a robot. It looks like you are a: @ScottSuarez, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look. You can help make sure that review is quick by doing a self-review and by running impacted tests locally. |
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are. Terraform GA: Diff ( 6 files changed, 857 insertions(+), 2 deletions(-)) |
Tests analyticsTotal tests: Click here to see the affected service packages
Action takenFound 2 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected testsTestAccFirebaseAppCheckDebugToken_firebaseAppCheckDebugTokenBasicExample|TestAccFirebaseAppCheckDebugToken_firebaseAppCheckDebugTokenUpdate |
Rerun these tests in REPLAYING mode to catch issues
|
7ef3952
to
7d47a6c
Compare
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are. Terraform GA: Diff ( 6 files changed, 857 insertions(+), 2 deletions(-)) |
@weixifan I distilled the requests to help with review. You can verify this manually in the generated code https://github.com/modular-magician/terraform-provider-google/compare/auto-pr-9930-old..auto-pr-9930#diff-7e164839ef21d8a5bf2f8b31c61bcce433157e556f95a7508a024c91f9ad3bb1 Create
Update (only displayName is updatable)
Delete
|
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are. Terraform GA: Diff ( 5 files changed, 799 insertions(+), 2 deletions(-)) |
Tests analyticsTotal tests: Click here to see the affected service packages
|
Hey @rainshen49. Looks like you're still working. Let me know when you want me to do a pass :) |
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are. Terraform GA: Diff ( 5 files changed, 798 insertions(+), 2 deletions(-)) |
Tests analyticsTotal tests: Click here to see the affected service packages
|
Hi @ScottSuarez this is ready for a pass. |
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 add a handwritten update test (assuming update is supported). Also quick feedback on the name, debug_token_id.
We can sync over a call on this too if that would help.
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are. Terraform GA: Diff ( 6 files changed, 881 insertions(+), 2 deletions(-)) |
Tests analyticsTotal tests: Click here to see the affected service packages
Action takenFound 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected testsTestAccFirebaseAppCheckDebugToken_firebaseAppCheckDebugTokenUpdate |
Rerun these tests in REPLAYING mode to catch issues
|
Hey @slevenick , could you take over here? I'll be out |
pattern: projects/{{project}}/apps/{{app_id}}/debugTokens/{{debug_token_id}} | ||
custom_flatten: 'templates/terraform/custom_flatten/firebase_app_check_debug_token.go.erb' | ||
- !ruby/object:Api::Type::String | ||
name: debug_token_id |
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.
I think this should be url_param_only instead of output. That also implies ignore_read
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.
It should also be required.
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.
debug_token_id
is generated by the server upon creation. The user is not expected to supply it. I guess this means it should be output only? This field is still needed to maintain the structure of the self_link
for import & reading.
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.
Ah I thought the user could set it.
In this case I think we should just use name
as the output-only field, remove debug_token_id, set self_link and the resource ID to {{name}} and remove the custom flattener
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.
How can I still support importing with all 3 formats?
[
"projects/{{project}}/apps/{{app_id}}/debugTokens/{{debug_token_id}}",
"{{project}}/{{app_id}}/{{debug_token_id}}",
"{{app_id}}/{{debug_token_id}}",
]
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.
Just a {{name}}
import format has caused confusion before. See hashicorp/terraform-provider-google#7907
Thus, I'm learning towards supporting it if able.
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.
Ok, how about just using {{name}} to represent the identifier that appears after debugTokens/
You can remove all instances of debug_token_id, replace with name, and use the standard 'templates/terraform/custom_flatten/name_from_self_link.erb' custom flatten
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.
I've also seen other resources do this. While this is probably the path with least custom code, I'm concerned about possible user confusion around ID and name. The underlying API neatly follows AIP-122. However, for a resource i.e.
resource "google_firebase_app_check_debug_token" "example" {
name = "server_generated_debug_token_id"
}
The AIP-122 Resource name is projects/{{project}}/apps/{{app_id}}/debugTokens/server_generated_debug_token_id
, but google_firebase_app_check_debug_token.example.name
gives “server_generated_debug_token_id”. In order to retrieve the AIP-122 resource name, users need to use google_pubsub_schema.example.id
. As you can see, Terraform's ID
and name
are swapped when compared with AIP-122's resource ID
and resource name
.
I'm fine with this solution. Is there any prior discussion in the team for this phenomenon? I expect more and more modern APIs to follow AIP-122 so the issue only becomes bigger. An official guidance would be appreciated 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.
As you indicated in the previous message, often users are confused by the long-form name 😉
It's fairly common in these Terraform providers for the name
field to mean just the short-form ending of the self link, and the .id
field is the long-form. So in this case I think it's sticking to precedent to continue using name as such. It might actually be worth calling it something different to identify that it's a server-set name rather than user-settable (you could go back to the original debug_token_id). In this case you could use api_name: name
and the shared custom_flatten, I just have a problem with using a custom flatten to read from a different field.
The AIPs are not commonly known by users, many APIs (like this one!) don't follow them all too well, and they aren't meant to be guidelines on how client surfaces represent APIs
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.
YES, this is what I'm looking for. I didn't know about the api_name
field, but it seems perfect for this use case. I was able to get it working with the additional identity
field. I'm very happy with how this turns out.
mmv1/templates/terraform/custom_flatten/firebase_app_check_debug_token.go.erb
Outdated
Show resolved
Hide resolved
c38232e
to
9ecd7ae
Compare
/gcbrun |
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are. Terraform GA: Diff ( 6 files changed, 872 insertions(+), 2 deletions(-)) |
Tests analyticsTotal tests: Click here to see the affected service packages
|
* App check debug token * Make app_id a parameter instead of a virtual field. It seems virtual fields are all forced optional. * Add update displayName test * Use api_name and identity to wire up debugTokenId
* App check debug token * Make app_id a parameter instead of a virtual field. It seems virtual fields are all forced optional. * Add update displayName test * Use api_name and identity to wire up debugTokenId
* App check debug token * Make app_id a parameter instead of a virtual field. It seems virtual fields are all forced optional. * Add update displayName test * Use api_name and identity to wire up debugTokenId
* App check debug token * Make app_id a parameter instead of a virtual field. It seems virtual fields are all forced optional. * Add update displayName test * Use api_name and identity to wire up debugTokenId
Add support for App Check debug tokens. Part of hashicorp/terraform-provider-google#17095
Release Note Template for Downstream PRs (will be copied)