Open sametimesolutions opened 5 years ago
@sametimesolutions From your use-case, 1 is the right way to do it. But, I will have to investigate why terraform show is not showing the states of these two machines separately. Will get back to you
@Prativa20 Thank you for checking.
I have the same question. I would love to be able to condense my environments under a single vRA deployment, but there doesn't seem to be a way to access the properties of the machines created when cluster
> 1.
I think the intention of cluster
is that you can tell vRA to spin multiple instances of the same blueprint under the deployment, but you can't modify them individually. We (those of us who have discovered the cluster
property) might be trying to use the tool in a way it's not designed for. But, I'm not sure either.
I have been using:
deployment_configuration = { "_number_of_instances" = "2" }
Then I realized that I can't dynamically grow or shrink my deployment. It doesn't trigger VRA to add or remove more instances. It only works for the initial apply.
I changed to @sametimesolutions above recommendation:
resource_configuration = { "vm._cluster" = "2" }
but it complains that I can't set vm._cluster higher than 1?
Error: Resource Machine Request Failed: vRealize API: [{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. SystemMessage:The value of the field with id _cluster cannot be more than 1.} {Code:400 Message: SystemMessage:}]
I asked the same question on the other terraform-provider-vra7 repo (https://github.com/terraform-providers/terraform-provider-vra7/issues/47) and @Prativa20 answered "The scale in/out is a day 2 action and this feature is not implemented yet. Thanks for opening this feature request. I will update soon about the timeline."
There are a couple of ways to create multiple instances using the VRA provider. 1) Using the _cluster property: resource "vra7_resource" "my_vmware_node" { wait_timeout = "${var.my_vmware_node_timeout}" catalog_name = "my_vmware_node" resource_configuration { vSpherevCenterMachine_1.memory = "512" vSpherevCenterMachine_1.cpu = "1" vSpherevCenterMachine_1._cluster = "2" 2) Using the catalog count: resource "vra7_resource" "brad_vmware_node" { wait_timeout = "${var.my_vmware_node_timeout}" catalog_name = "my_vmware_node" count = 2
Results of deployment: 1), 2 vms are created but the terraform state only has information about vSpherevCenterMachine_1. You can not get any of the information for n + 1 vms. This would require another call to vra to get the information.
2), 2 catalogs are created in vra and each catalog has 1 vm. You can access both of the vm state information based on the catalog resource[number] name. Which is better than option 1. The downside is you end up with a lot of catalog request in vra.
What is the right way to spin up multiple vms? Is it ok to have many catalog requests to achieve vm multiplicity? Is this the best practice? Or are these 2 distinct usecases and there is a bug in 1)?