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

Be more forgiving when parsing IDs in service networks_values #575

Merged
merged 1 commit into from
Oct 18, 2024

Conversation

sk4zuzu
Copy link
Collaborator

@sk4zuzu sk4zuzu commented Oct 18, 2024

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 PR followers and do not help prioritize the request

Description

GOCA defines networks_values as:

NetworksVals    []map[string]interface{} `json:"networks_values,omitempty"`

which as unspecified as it could be allows for both numeric and string network IDs.

This PR makes the following snippet work:

resource "opennebula_service" "service" {
  name = "service"

  template_id = opennebula_service_template.service.id

  extra_template = jsonencode({
      networks_values = [
        { service = { id = data.opennebula_virtual_network.service.id } },
        { private = { id = tonumber(opennebula_virtual_network.reservation.id) } },
      ]
  })
}

References

#000

New or Affected Resource(s)

  • opennebula_service

Checklist

  • I have created an issue and I have mentioned it in References
  • My code follows the style guidelines of this project (use go fmt)
  • My changes generate no new warnings or errors
  • I have updated the unit tests and they pass succesfuly
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation (if needed)
  • I have updated the changelog file

opennebula/helpers.go Outdated Show resolved Hide resolved
@sk4zuzu sk4zuzu merged commit 5004af7 into master Oct 18, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants