-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 liens resource. Fixes #1435. #1484
Add liens resource. Fixes #1435. #1484
Conversation
This could use some acceptance tests, unfortunately the generator isn't smart enough to write them yet :) |
Oh, absolutely. :) |
|
||
``` | ||
$ terraform import google_resourcemanager_lien.default liens/{{name}} | ||
$ terraform import google_resourcemanager_lien.default {{name}} |
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.
Hum, why do we generate twice the same format?
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.
Because the second one removes {{project}}
but that's not in the import ID here. I'm going to fix that.
|
||
log.Printf("[DEBUG] Finished creating Lien %q: %#v", d.Id(), res) | ||
|
||
d.SetId(res["name"].(string)) |
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 am not sure why this is required since line 110-114 should basically be doing the same thing right?
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 be, except we don't have "name" yet - the only unique ID here is the server-generated one.
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 comment in the custom code template to explain this?
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.
Done - working its way through generation now.
return err | ||
} | ||
|
||
url, err = replaceVars(d, config, "https://cloudresourcemanager.googleapis.com/v1/{{name}}") |
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 doesn't sound right. Unless name includes lien/{project_number}
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 does, unfortunately - the result back from the server is lien/a-long-uuid
. Nothing for it. :(
d30e21b
to
496936a
Compare
A stable, user-visible/meaningful string identifying the origin | ||
of the Lien, intended to be inspected programmatically. Maximum length of | ||
200 characters. | ||
* `parent` - |
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 feel like at the very least, parent
and restrictions
should be Required, shouldn't they?
60d4565
to
3bb176f
Compare
0a35dc9
to
b215897
Compare
75fd373
to
c803aa9
Compare
9387060
to
884f511
Compare
Unit test added and passes. LMK what you think! What changes still need to be made here? |
ResourceName: "google_resource_manager_lien.lien", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
ImportStateIdFunc: func(_ *terraform.State) (string, error) { |
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 has to be a function because otherwise lien.Name wouldn't resolve, right? Can you add a comment to that extent?
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.
Fixed.
Lien can be imported using any of these accepted formats: | ||
|
||
``` | ||
$ terraform import google_resourcemanager_lien.default {{parent}}/{{name}} |
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.
These are all the same, mind fixing whatever's generating 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.
Fixed that, working its way through generation now.
884f511
to
9c22393
Compare
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks! |
/cc @ndmckinley