-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
google_active_folder data lookup: make parent optional #7509
Conversation
eb1baa6
to
b247589
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.
Generally looks good- we'll just want to update the website as well.
queryString := fmt.Sprintf("lifecycleState=ACTIVE AND parent=%s AND displayName=\"%s\"", parent, displayName) | ||
// parent is optional | ||
if parent, ok := d.GetOk("parent"); ok { | ||
queryString := fmt.Sprintf("lifecycleState=ACTIVE AND parent=%s AND displayName=\"%s\"", parent.(string), displayName) |
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.
You'll need to initialize the variable outside of this if block, and then set a value inside. As-is it isn't in scope when it gets used later.
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.
Thank you! This is very helpful, I was wondering whether it was the case.
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- now, you'll want to change :=
to =
on lines 43 and 45. As-is, you're shadowing the queryString
variable above instead of assigning a value to 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.
Hey, thank you - fixed that now. This should be good to go I think?
b247589
to
c4b07cc
Compare
Google folder lookup API finds folders perfectly fine without providing the folder parent: ``` "query": "lifecycleState=ACTIVE AND displayName=\"Engineering\"" { "folders": [ { "name": "folders/<Redacted>", "parent": "organizations/<Redacted>", "displayName": "Engineering", "lifecycleState": "ACTIVE", "createTime": "2019-06-14T09:20:35.233Z" } ] } "query": "lifecycleState=ACTIVE AND displayName=\"Global Dev\"" Results returned just fine: { "folders": [ { "name": "folders/<Redacted>", "parent": "folders/<Redacted>", "displayName": "Global Dev", "lifecycleState": "ACTIVE", "createTime": "2020-06-16T11:41:45.998Z" } ] } ```
c4b07cc
to
5eb78fd
Compare
8008447
to
93807a9
Compare
Hey @rileykarson apologies, I just came to fixing this. Tests pass now |
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'll need to make a pull request against https://github.com/GoogleCloudPlatform/magic-modules cloning this PR and merge this at the same time as the one there.
Co-authored-by: Madhura Phadnis <[email protected]> Signed-off-by: Modular Magician <[email protected]>
Signed-off-by: Modular Magician <[email protected]> Co-authored-by: Madhura Phadnis <[email protected]>
Closing PR as stale |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Issue: when using a nested folder structure, it is proving challenging to use the existing data resource due to the need to know the parent ID.
Google folder lookup API finds folders perfectly fine without providing the parent: