-
Notifications
You must be signed in to change notification settings - Fork 322
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
VSphere tags in inventory #88
Conversation
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 is great, thanks very much for tackling this. This is the first provider I've seen to work in a way other than here's a list tags for each resource. Just a couple of comments.
parser_test.go
Outdated
"default_ip_address": "10.20.30.50" | ||
"default_ip_address": "10.20.30.50", | ||
"tags.#": "1", | ||
"tags.1357913579": "urn:vmomi:InventoryServiceTag:00000000-0001-4957-81fa-1234567890ab:GLOBAL" |
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.
Please fix the indentation in this file. It's not caught by gofmt because it's a humungous JSON string.
parser.go
Outdated
@@ -52,13 +53,26 @@ func (s *state) outputs() []*Output { | |||
return inst | |||
} | |||
|
|||
func (s *state) mapidnames() map[string]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.
Please rename this to something a bit more descriptive, and/or add a docstring. I know this is a private method, but I'm having trouble understanding exactly what it does.
I modified the files, is that enough? |
This functionality is brilliant. |
Thanks very much for this patch! I suspect that many other providers do/will work like this, so this will be a useful template in addition to the functionality. Sorry about the very slow review. |
I'm using terraform with VSphere provider.
And I use tags : https://www.terraform.io/docs/providers/vsphere/d/tag.html
In my terraform.tfstate file the tag names are not directly in the resources.
To solve this, I create a map of ID => name of all resources.
And during "inventorize tags", I look for "ID" in the map to replace with tag name.