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

Allow named regions for vpshere cloud account #564

Open
attish76 opened this issue Jan 10, 2025 · 0 comments
Open

Allow named regions for vpshere cloud account #564

attish76 opened this issue Jan 10, 2025 · 0 comments
Labels
enhancement Enhancement

Comments

@attish76
Copy link

When creating a cloud account as below, the region name is the same as the externalRegionId.
This is different from what you get when creating the cloud account manually in the VRA UI, where the region name is <Folder>/<Datacenter name>

 resource "vra_cloud_account_vsphere" "vcs01" {
  name        = "vcs01.example.net"
  description = ""
  username    = var.username
  password    = var.password
  hostname    = "vcs01.example.net"
  regions     = ["Datacenter:datacenter-2001"]
  accept_self_signed_cert = true
}
[{'cloudAccountType': 'vsphere',
  'cloudAccountProperties': {'hostName': 'vcs01.example.net',
   'privateKeyId': '***',
   'supportTagging': '{"documentKinds":["com:vmware:photon:controller:model:resources:ComputeService:ComputeState"],"enabled":true}',
   'supportDatastores': 'true'},
  'enabledRegionIds': ['Datacenter:datacenter-2001'],
  'enabledRegions': [{'externalRegionId': 'Datacenter:datacenter-2001',
    'name': 'Datacenter:datacenter-2001',
  ...

However, both region emulation provides the DC name, and creating cloud accounts allows setting the region name

POST /iaas/api/cloud-accounts-vsphere/region-enumeration'
{
   'externalRegions': [
              {'externalRegionId': 'Datacenter:datacenter-2001', 'name': 'USA/DC01'}
  ]
'externalRegionIds': [
     'Datacenter:datacenter-2001'
]
POST /iaas/api/cloud-accounts-vsphere

  "regions": [
    {
      "name": "Datacenter:datacenter-3",
      "externalRegionId": "Datacenter:datacenter-3"
    }
  ],

Recommended solution

  • Add new attribute externalRegions to data_source_vra_region_enumeration_vsphere
    This is map created from the externalRegions value of the region-enumration output, where key=name, value = externalRegionId.

  • In resource_vra_cloud_account_vsphere, allow users to specify RegionSpecification themselves, instread of being generated by expandRegionSpecificationList

    func expandRegionSpecificationList(rList []interface{}) []*models.RegionSpecification {

@attish76 attish76 added enhancement Enhancement needs-triage Needs Triage labels Jan 10, 2025
@tenthirtyam tenthirtyam removed the needs-triage Needs Triage label Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement
Projects
None yet
Development

No branches or pull requests

2 participants