Skip to content
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

Merged
merged 3 commits into from
May 17, 2018

Conversation

modular-magician
Copy link
Collaborator

@danawillow
Copy link
Contributor

This could use some acceptance tests, unfortunately the generator isn't smart enough to write them yet :)

@nat-henderson
Copy link
Contributor

Oh, absolutely. :)


```
$ terraform import google_resourcemanager_lien.default liens/{{name}}
$ terraform import google_resourcemanager_lien.default {{name}}
Copy link
Contributor

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?

Copy link
Contributor

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))
Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Contributor

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?

Copy link
Contributor

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}}")
Copy link
Contributor

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}

Copy link
Contributor

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. :(

@modular-magician modular-magician force-pushed the codegen-pr-191 branch 4 times, most recently from d30e21b to 496936a Compare May 15, 2018 23:38
A stable, user-visible/meaningful string identifying the origin
of the Lien, intended to be inspected programmatically. Maximum length of
200 characters.
* `parent` -
Copy link
Contributor

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?

@nat-henderson
Copy link
Contributor

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) {
Copy link
Contributor

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?

Copy link
Contributor

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}}
Copy link
Contributor

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?

Copy link
Contributor

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.

@nat-henderson nat-henderson merged commit 56481d8 into hashicorp:master May 17, 2018
chrisst pushed a commit to chrisst/terraform-provider-google that referenced this pull request Nov 9, 2018
@ghost
Copy link

ghost commented Nov 18, 2018

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!

@ghost ghost locked and limited conversation to collaborators Nov 18, 2018
@modular-magician modular-magician deleted the codegen-pr-191 branch November 16, 2024 20:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants