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

Issue with region name being the same as externalRegionId #472

Open
1 task done
an2ane opened this issue Oct 24, 2022 · 7 comments
Open
1 task done

Issue with region name being the same as externalRegionId #472

an2ane opened this issue Oct 24, 2022 · 7 comments
Labels
bug Something isn't working product-issue Bug or limitation in vRA or vRA Cloud

Comments

@an2ane
Copy link
Contributor

an2ane commented Oct 24, 2022

Code of Conduct

This project has a Code of Conduct that all participants are expected to understand and follow:

vRA Version

vRA Cloud 8.10.0

Terraform Version

0.12+

vRA Terraform Provider Version

0.6.0

Affected Resource(s)

vra_region
vra_zone
vra_cloud_account_vsphere

When creating a vra_cloud_account_vsphere resource, the related regions name share the same value as externalRegionId.

Terraform Configuration Files

data "vra_region_enumeration_vsphere" "this" {
  accept_self_signed_cert = false
  dc_id        = var.dc_id
  hostname    = var.vcenter_hostname
  username    = var.vcenter_username
  password    = var.vcenter_password
}

resource "vra_cloud_account_vsphere" "this" {
  name        = "tf-vsphere-account"
  description = "foobar"
  hostname    = var.vcenter_hostname
  username    = var.vcenter_username
  password    = var.vcenter_password
  dc_id        = var.dc_id

  regions                      = data.vra_region_enumeration_vsphere.this.regions
  associated_cloud_account_ids = []
  accept_self_signed_cert      = true
}

data "vra_region" "this" {
  filter = name eq "my_dc_name"
}

Expected Behavior

The way it was working with the vra provider 0.4.x was great. We had the name and the id from the vCenter, not the id set twice in name and externalRegionId variables

Actual Behavior

{
    "content": [
        {
            "externalRegionId": "Datacenter:datacenter-3",
            "name": "Datacenter:datacenter-3",
            "cloudAccountId": "cloudaccount_id",
            "id": "region_id",
            "updatedAt": "2022-10-24",
            "organizationId": "org_id",
            "orgId": "org_id",
            "_links": {
                "self": {
                    "href": "/iaas/api/regions/region_id"
                },
                "cloud-account": {
                    "href": "/iaas/api/cloud-accounts/cloudaccount_id"
                }
            }
        }
    ],
    "totalElements": 1,
    "numberOfElements": 1
}

Steps to Reproduce

terraform {
  required_version = ">= 0.12"
  required_providers {
    vra = {
      source = "vmware/vra"
      version = "0.6.0"
    }
  }
}
  1. terraform apply
  2. Make a GET API call to https://de.api.mgmt.cloud.vmware.com/iaas/api/regions
  3. See the name and externalRegionId being the same

Screenshots

result

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
@an2ane an2ane added bug Something isn't working needs-triage labels Oct 24, 2022
@frodenas frodenas added product-issue Bug or limitation in vRA or vRA Cloud and removed needs-triage labels Oct 27, 2022
@frodenas
Copy link
Member

Newer versions of the vRA API require setting the region id and name when creating a vSphere cloud account (older versions only required the id). The region name specified can be any name, it does not need to match the real name of the region, it's just an internal reference for the cloud account. When using the vRA UI you will see that the region name shown in the cloud account is not the one used at the cloud account creation API, it is the real region name, but when you use the API to retrieve the cloud account, you will get the name specified at creation time (and not the real region name).

This is a limitation we discovered when we upgraded the SDK version (#421 ). At that time we decided that making an extra call inside the Terraform provider to get the real region name was too expensive and that the limitation should be addressed inside vRA and not the terraform provider. Additionally, as this is something internal (we only show the id as part of the terraform resource schema), it should not affect end users (if this is not accurate, I'd like to understand your use case).

We currently have a story (internal reference #VRAE-12847) to address this limitation in vRA, but unfortunately, I cannot provide you any estimate on when this will be addressed.

@an2ane
Copy link
Contributor Author

an2ane commented Oct 28, 2022

Hello Ferran.

When using the old 0.4.1 vra provider (as it was using the old sdk), we were fetching the vra_region not by its id but by its name, which is currently the same as the datacenter we have on vSphere. Since the new sdk, as you mentionned, the vra_region name is also required but set with the same value as the datacenter id, Datacenter:datacenter-3.

Even though it does create the region on vRA successfully, this is less friendly-user as it was created before the sdk update. Knowing the dc name is easier than knowing the dc id, when getting the vra_region. Is there another way to get the region_id without using?

data "vra_region" "this" {
  filter = "name eq '${var.vra_region_name}'"
}

Maybe a foreach on vra_region_enumration_vsphere?

Glad to hear the issue is tracked by the vRA team :)

@an2ane
Copy link
Contributor Author

an2ane commented Jul 4, 2023

Hello @frodenas.

Do you have any update about VRAE-12847?

@frodenas
Copy link
Member

frodenas commented Jul 5, 2023

@an2ane Unfortunately, I don't have any updates yet.

@powertim
Copy link

As deploying a new production stack, this bug is very confusing. I'd like this to be fixed.

@BerryR-RBA
Copy link

This is the interface for Cloud Accounts:

Datacenters

And this is the interface for Cloud Zones:

Regions

How do I know which region is which, without checking URLs in the vCenter?

@BerryR-RBA
Copy link

Hi @frodenas,

I understand that vRA limitations have made this difficult. But we now have a situation where deployed configurations are using externalRegionId as the name.

When the provider is fixed, how will we migrate to actual names without rebuilding our infrastructure?

Thanks
Rob B.

@tenthirtyam tenthirtyam changed the title Issue with vRA region name being the same as externalRegionId Issue with region name being the same as externalRegionId Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working product-issue Bug or limitation in vRA or vRA Cloud
Projects
None yet
Development

No branches or pull requests

4 participants