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

datasources vcd_resource_list and vcd_resource_schema #594

Merged
merged 35 commits into from
Nov 25, 2020

Conversation

dataclouder
Copy link
Collaborator

@dataclouder dataclouder commented Nov 17, 2020

vcd_resource_list

  • List deployed resources by name, ID,or HREF
  • List deployed resources with import command

data source gives information about VCD, with a list of available resources, in several formats.

data "vcd_resource_list" "list_of_orgs" {
  name          = "list_of_orgs"
  resource_type = "org"
  list_mode     = "name_id"
}

// Shows the list of organizations with the corresponding ID
output "org_list" {
  value = data.vcd_resource_list.list_of_orgs.list
}

vcd_resource_schema

  • Shows the structure of any resource in terraform-provider-vcd
data "vcd_resource_schema" "net_struct" {
  name "net_struct"
  resource_type = "vcd_network_isolated"
}

// Shows the structure of resource network_isolated
output "net_struct" {
  value = data.vcd_resource_schema.net_struct
}

More examples in the docs page.
This PR resumes work started in PR #415

@dataclouder dataclouder marked this pull request as ready for review November 18, 2020 09:48
Copy link
Collaborator

@Didainius Didainius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great things with immediate use cases now:)

A few general comments on docs:

  • Looks like HCL examples don't like // for comments when highlighting ( at least the old engine). I think default HCL comment # should reender it better:

image

  • Given that it is not a standard resource maybe "Example Usage 1...n" headers could have titles. Like "Example Usage 1 (List all organizations)" instead of just "Example Usage 1":

image

CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Show resolved Hide resolved
// * mediaItem (catalog)
// * all edge gateway objects (NAT, firewall, lb)
// When the parent is org or vdc, they are taken from the regular fields above
"parent": {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am missing a bit more docs and it is not immediately clear what should be provided. Might be that name parent_name could be easier to grasp. Also some examples in docs could use this method.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added some examples in the docs

vcd/datasource_vcd_resource_list_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@vbauzys vbauzys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I know we are not experts in HCL scripting, but it would be good to figure out for ourselves and for others to write in documentation(examples) for e.g. how to take out value from this data and use in next resource:

output: 
list_networks_hierarchy = [
  "datacloud  vdc-datacloud  net-datacloud-r",
  "datacloud  vdc-datacloud  net-datacloud-i",
  "datacloud  vdc-datacloud  net-datacloud-r2",
  "datacloud  vdc-datacloud  net-datacloud-d",
]

vcd/datasource_vcd_resource_list.go Show resolved Hide resolved
vcd/datasource_vcd_resource_list.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@lvirbalas lvirbalas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One tiny thing and one huge question.

.changes/v3.1.0/594-features.md Outdated Show resolved Hide resolved
website/docs/d/resource_list.html.markdown Show resolved Hide resolved
@dataclouder dataclouder changed the title datasources vcd_resource_info and vcd_resource_schema datasources vcd_resource_list and vcd_resource_schema Nov 24, 2020
Copy link
Collaborator

@lvirbalas lvirbalas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now and very useful!

@dataclouder dataclouder merged commit 8fac870 into vmware:master Nov 25, 2020
@dataclouder dataclouder deleted the new-datasource-vcd-info branch November 20, 2023 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants