-
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
Add custom flatten for monitoring channel labels #1251
Add custom flatten for monitoring channel labels #1251
Conversation
Is this resolving a user's issue? Also -me, @chrisst has the most context here. |
Added issue to description |
I am a robot that works on MagicModules PRs! I built this PR into one or more PRs on other repositories, and when those are closed, this PR will also be merged and closed. |
Thanks! |
} | ||
|
||
replace := true | ||
for i := 0; i < len(stateLabel); i++ { |
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.
Could this just be a regex match for "serverLabel matches \*+
and len(stateLabel) = len(serverLabel)
"?
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 suppose so? This is ugly but it matches against the rest of the value that isn't asterisked.
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.
Sorry, what does that mean? Can you post an example of two strings you need to compare?
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.
Am I right in understanding that a len 4 label (for certain labels) submitted to the api will come back obfuscated as a len 4 "****" ?
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.
**CRET vs SECRET (see hashicorp/terraform-provider-google#2839)
It appears that len(secret) <= 4 is left as is. I'm not sure I want to rely on the unobfuscated value always being 4 characters, hence the ugly match, but if you feel like that's an ok thing to rely on, I can change it.
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 partially obfuscates them? Goodness. Okay, let me see if I can devise a regex for that ... Whew.
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.
Yeah, my way is doable but worse. Your solution LGTM - please explain in comments, if you don't mind.
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 just... wow
I ran into these "sensitive" fields in a different api and never really came up with a perfect solution. My understanding of what you have is "if server sends back stars, overwrite server response with local version". But I think that means you aren't able to tell if the user has actually changed the value of the sensitive label from "foo" to "bar". I ended up with a similar strategy of returning whatever was coming from d.Get instead of the api response for sensitive fields. Right now the only issue I see is that it's hard to read what is going on. I think a small refactor would clear up what is going on. Maybe something like:
it can help reduce the number of break conditions in your loop and you can throw a couple quick tests around the helper method with expected inputs and outputs. |
3a86e05
to
47ee5ed
Compare
I am (still) a robot that works on MagicModules PRs! I just wanted to let you know that your changes (as of commit bb4b9c5) have been included in your existing downstream PRs. |
47ee5ed
to
53f0113
Compare
I am (still) a robot that works on MagicModules PRs! I just wanted to let you know that your changes (as of commit ac00e11) have been included in your existing downstream PRs. |
I am (still) a robot that works on MagicModules PRs! I just wanted to let you know that your changes (as of commit b125b16) have been included in your existing downstream PRs. |
I am (still) a robot that works on MagicModules PRs! I just wanted to let you know that your changes (as of commit bdfbaa2) have been included in your existing downstream PRs. |
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.
The examples/tests help a ton, thanks.
I am (still) a robot that works on MagicModules PRs! I just wanted to let you know that your changes (as of commit 749a445) have been included in your existing downstream PRs. |
Tracked submodules are build/terraform-beta build/terraform build/ansible build/inspec.
0084b3a
to
ad8702e
Compare
Also fix some "pertain" license text 😠
Why this is a custom flatten:
Fixes hashicorp/terraform-provider-google#2839
[all]
[terraform]
Add custom flatten for monitoring channel labels
[terraform-beta]
Add custom flatten for monitoring channel labels
[ansible]
[inspec]