Description
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 theexternalRegions
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
terraform-provider-vra/vra/regions.go
Line 31 in 120c582