vmware / terraform-provider-vra7

Terraform VMware vRealize Automation 7 provider - VMware has ended the active development of this Terraform Provider, so this repository will no longer be updated.
https://registry.terraform.io/providers/vmware/vra7/latest
Mozilla Public License 2.0
39 stars 33 forks source link

Problem with cluster value (not integer) #98

Open jmandl opened 3 years ago

jmandl commented 3 years ago

vRA 7.6 version The vRA 7.6 version where is issue is found. Terraform version Terraform v0.12.24 terraform-provider-vra7 plugin version

Describe the bug Since I upgrade the terraform provider to 2.0.1 the cluster information should be informed. I tried the following options: -1 - Terraform show this message: Code:20117 Message:The data specified within the request is invalid. SystemMessage:The data specified within the request is invalid.} {Code:11002 Message:The value of the '_cluster' field cannot be less than 1 0 - Terraform show this message: Code:20117 Message:The data specified within the request is invalid. SystemMessage:The data specified within the request is invalid.} {Code:11003 Message:The value of the '_cluster' field cannot be more than 1 1 - Terraform show this message: An internal error occurred. Details: [Cluster size is not integer for a component in blueprint: 2 - Terraform show this message: Code:20117 Message:The data specified within the request is invalid. SystemMessage:The data specified within the request is invalid.} {Code:11003 Message:The value of the '_cluster' field cannot be more than 1.

If i downgrade the provider to 1.0.1 everything works as expected.

I am using terraform with CentOS 8.

--- resource.tf file: resource "vra7_deployment" "test" { count = 1 catalog_item_id = var.catalog_item_id businessgroup_id = var.businessgroup_id description = "HTTPS Server - TerraForm" reasons = "https" deployment_configuration = { _leaseDays = "0" _number_of_instances = 1 _deploymentName= "https" deployment_property = "Team" }

resource_configuration { component_name = var.component_XAAS cluster = 1 configuration = { .. REMOVED } } resource_configuration { component_name = "OS_Linux" cluster = 1 configuration = { .. REMOVED } } wait_timeout = 20 }

Prativa20 commented 3 years ago

@jmandl Please upgrade to latest provider version 3.0.0 and let me know if you still see an issue.

Please refer to the documentation for examples https://github.com/vmware/terraform-provider-vra7/blob/master/website/docs/r/deployment.html.markdown

Thanks, Prativa

jmandl commented 3 years ago

Hi @Prativa20 , I tryed the latest version, but the provider still send _cluster as a string:

2021-02-18T16:42:58.137-0300 [DEBUG] plugin.terraform-provider-vra7_v3.0.1: "key": "_cluster", 2021-02-18T16:42:58.137-0300 [DEBUG] plugin.terraform-provider-vra7_v3.0.1: "value": { 2021-02-18T16:42:58.137-0300 [DEBUG] plugin.terraform-provider-vra7_v3.0.1: "type": "string", 2021-02-18T16:42:58.137-0300 [DEBUG] plugin.terraform-provider-vra7_v3.0.1: "value": "1" 2021-02-18T16:42:58.137-0300 [DEBUG] plugin.terraform-provider-vra7_v3.0.1: }

terraform version
2021/02/18 16:45:51 [INFO] Terraform version: 0.14.7 2021/02/18 16:45:51 [INFO] Go runtime version: go1.15.6 2021/02/18 16:45:51 [INFO] CLI args: []string{"/usr/local/bin/terraform", "version"} 2021/02/18 16:45:51 [DEBUG] Attempting to open CLI config file: /home/joao/.terraformrc 2021/02/18 16:45:51 [DEBUG] File doesn't exist, but doesn't need to. Ignoring. 2021/02/18 16:45:51 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins 2021/02/18 16:45:51 [DEBUG] ignoring non-existing provider search directory /home/joao/.terraform.d/plugins 2021/02/18 16:45:51 [DEBUG] ignoring non-existing provider search directory /home/joao/.local/share/terraform/plugins 2021/02/18 16:45:51 [DEBUG] ignoring non-existing provider search directory /usr/local/share/terraform/plugins 2021/02/18 16:45:51 [DEBUG] ignoring non-existing provider search directory /usr/share/terraform/plugins Terraform v0.14.7 2021/02/18 16:45:51 [INFO] CLI command args: []string{"version"}

Maybe this behavior is happening because inside my blueprint I have an vRO workflow that make some changes inside the Virtual Machine and when the GO Provider tries to get the /template/ it get two "classId": "Blueprint.Component.Declaration", I can share more details with you, but since there is some sensitive data from the company I can´t share here.

I have all traces with me, if you could contact me: jmandl@pagseguro.com .

Prativa20 commented 3 years ago

@jmandl Sure, we can sync up. I will reach out to you with availability.

chewbh commented 3 years ago

vRA 7.6 version The vRA 7.6 version where the issue is found.

Terraform version Terraform v0.13.5

terraform-provider-vra7 plugin version

Describe the bug I faced the same issue with using both v2.0.1 and v3.0.1 of this provider. v1.0.3 is the only version that work when cluster is not supplied.

From the trace, in both newer version of the provider, terraform will add an additional attribute _cluster=1 if cluster parameter is not provided in the resource configuration for a given component to the request (which is in json format) when sending a POST to /catalog-service/api/consumer/entitledCatalogItems/******/requests.

From the json, value supplied is indeed an integer and not a string

...
{
"data": {
"_cluster": 1
...
}

Strangely, when the provider checking the request status via rest call to /catalog-service/api/consumer/requests/***, _cluster is reflected to have data type of string with value 1.

In v1.0.3, when cluster is supplied (regardless of the value), the error will be encountered. Thus, I believe the issue might not be in this provider but likely resides in vRA 7.6 restful catalog service API (specifically, the POST request to entitledCatalogItems).

However, as newer version of the provider auto-append the _cluster attribute when cluster is not provided, POST request to entitledCatalogItems will failed in vRA 7.6. Therefore, until a fix is provided, we have to fallback to v1.0.3 and not using the cluster parameter in the meantime.

In addition, do I need to separately raise this issue with vRA 7.6 rather just reporting here? Thanks.