oracle / terraform-provider-oci

Terraform Oracle Cloud Infrastructure provider
https://www.terraform.io/docs/providers/oci/
Mozilla Public License 2.0
758 stars 675 forks source link

Documentation for oci_os_management_hub_software_sources is incorrect (or at least incomplete) #2118

Open jeliker opened 4 months ago

jeliker commented 4 months ago

Community Note

Terraform Version and Provider Version

Terraform v1.5.7
on darwin_amd64
+ provider registry.terraform.io/oracle/oci v5.42.0

Affected Resource(s)

affected_resources = oci_os_management_hub_software_sources

Terraform Configuration Files

data "oci_os_management_hub_software_sources" "iad" {
  #Required
  compartment_id = local.tenancy_ocid
}

#Comparing to OSMS vs. OSMH above
data "oci_osmanagement_software_sources" "iad" {
  #Required
  compartment_id = local.tenancy_ocid
}

Debug Output

Panic Output

Expected Behavior

  1. Per documentation, oci_os_management_hub_software_sources has software_source_collection which apparently is iterable. image

  2. Actually, software_source_collection itself is a list of 1 which contains items which is list of software sources

    This will cause error though documentation suggests otherwise

    [ for s in data.oci_os_management_hub_software_sources.iad.software_source_collection : s.display_name ]

    This will work which is apparent after examining underlying API documentation (vs. Terraform provider docs alone)

    [ for s in data.oci_os_management_hub_software_sources.iad.software_source_collection[0].items : s.display_name ]
  3. Compare to this which has similar documentation and behaves as expected. image

  4. This will work for oci_osmanagement_software_sources

    [ for s in data.oci_osmanagement_software_sources.iad.software_sources : s.display_name ]