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

Incorrect storage_backing input for vsphere_content_library #1351

Closed
cleeistaken opened this issue Feb 26, 2021 · 3 comments · Fixed by #1577
Closed

Incorrect storage_backing input for vsphere_content_library #1351

cleeistaken opened this issue Feb 26, 2021 · 3 comments · Fixed by #1577
Labels
bug Type: Bug

Comments

@cleeistaken
Copy link

Terraform Version

0.14.7
0.15.0-beta1

vSphere Provider Version

vSphere 7.0U1

Affected Resource(s)

  • vsphere_content_library

Description

When deploying a content library the documentation is not correct. The documentations and sample code outlines a string as the input for the storage_backup parameter. This appears correct and consistent with other resources and vSphere functionality.

In actuality terraform is expecting a set of strings (see workaround).

Request

The storage_backup parameter should take a single managed object reference ID as outlined in the documentation.

Terraform Configuration Files

data "vsphere_datacenter" "dc" {
  name = "dc1"
}

data "vsphere_datastore" "datastore" {
  name          = "datastore1"
  datacenter_id = data.vsphere_datacenter.dc.id
}

resource "vsphere_content_library" "library" {
  name            = "Content Library Test"
  storage_backing = data.vsphere_datastore.datastore.id
  description     = "A new source of content"
}

Actual Behavior

Error: Incorrect attribute value type

  on modules/template/main.tf line 41, in resource "vsphere_content_library" "library":
  41:   storage_backing = data.vsphere_datastore.vs_ds.id
    |----------------
    | data.vsphere_datastore.vs_ds.id is "datastore-17"

Inappropriate value for attribute "storage_backing": set of string required.

Workaround

data "vsphere_datacenter" "dc" {
  name = "dc1"
}

data "vsphere_datastore" "datastore" {
  name          = "datastore1"
  datacenter_id = data.vsphere_datacenter.dc.id
}

resource "vsphere_content_library" "library" {
  name            = "Content Library Test"
  storage_backing = [data.vsphere_datastore.datastore.id]  # <------- create a set
  description     = "A new source of content"
}
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # module.template[0].vsphere_content_library.library will be created
  + resource "vsphere_content_library" "library" {
      + description     = "A new source of content"
      + id              = (known after apply)
      + name            = "Content Library Test"
      + storage_backing = [
          + "datastore-17",
        ]

      + publication {
          + authentication_method = (known after apply)
          + password              = (known after apply)
          + publish_url           = (known after apply)
          + published             = (known after apply)
          + username              = (known after apply)
        }
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

module.template[0].vsphere_content_library.library: Creating...
module.template[0].vsphere_content_library.library: Creation complete after 1s [id=f733b21b-dd63-46d4-8b58-81e86f2c582d]

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

References

https://registry.terraform.io/providers/hashicorp/vsphere/latest/docs/resources/content_library

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
@cleeistaken cleeistaken added the bug Type: Bug label Feb 26, 2021
@tenthirtyam
Copy link
Collaborator

tenthirtyam commented Nov 1, 2021

@cleeistaken,

Upstream, this is a requirement in vmware/govmoni. The best method to address this is to update the documentation for the vsphere_content_library resource to the depict the need to convert it to a set as follows:

data "vsphere_datacenter" "dc" {
  name = "dc1"
}

data "vsphere_datastore" "datastore" {
  name          = "datastore-name"
  datacenter_id = data.vsphere_datacenter.dc.id
}

resource "vsphere_content_library" "library" {
  name            = "Content Library"
  storage_backing = [data.vsphere_datastore.datastore.id]
}

I'll submit a PR to resolve the issue in the documentation.

Ryan
@tenthirtyam

@tenthirtyam tenthirtyam self-assigned this Jan 29, 2022
@tenthirtyam tenthirtyam changed the title vsphere_content_library storage_backing input type in incorrect Incorrect storage_backing input for vsphere_content_library Feb 4, 2022
@tenthirtyam
Copy link
Collaborator

@appilon I included a correction for this one in #1502. I think I can cherry-pick this one out and address this one in a separate pull to get this one resolved sooner.

Ryan

appilon pushed a commit that referenced this issue Feb 8, 2022
- Updates the content of the documentation - `content_library.html.markdown` - for readability, context, and accuracy.
- Updates the content of the documentation - `content_library.html.markdown` - with subscribed library example.
- Updates the examples to use `storage_backing` to use a set as required. Addresses #1351

Signed-off-by: Ryan Johnson <[email protected]>
@tenthirtyam tenthirtyam removed their assignment Feb 17, 2022
@github-actions
Copy link

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Type: Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants