Closed whzzz28 closed 2 years ago
@whzzz28 the acceptance tests used for verifying the providers functionality are a good source of examples that are well tested. This example in particular ensures that the high availability field is changed from the default to restart
.
Can you confirm that high availability argument is using a colon and not an equals sign (as seen below)? That is not the correct way to supply arguments to a resource.
high_availability: "restart"
Please reproduce the issue while terraform is running in debug mode (TF_LOG=debug terraform apply
) and provide the output on this issue so I can investigate what is happening.
Hi, Apply throws an error when using a colon. Below is a copy of the output with debug set:
[n105659@xxx tf_working]$ TF_LOG=debug terraform apply
2022-06-08T10:34:58.504+1000 [INFO] Terraform version: 1.2.1
2022-06-08T10:34:58.504+1000 [DEBUG] using github.com/hashicorp/go-tfe v1.0.0
2022-06-08T10:34:58.504+1000 [DEBUG] using github.com/hashicorp/hcl/v2 v2.12.0
2022-06-08T10:34:58.504+1000 [DEBUG] using github.com/hashicorp/terraform-config-inspect v0.0.0-20210209133302-4fd17a0faac2
2022-06-08T10:34:58.504+1000 [DEBUG] using github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734
2022-06-08T10:34:58.504+1000 [DEBUG] using github.com/zclconf/go-cty v1.10.0
2022-06-08T10:34:58.504+1000 [INFO] Go runtime version: go1.18.1
2022-06-08T10:34:58.504+1000 [INFO] CLI args: []string{"terraform", "apply"}
2022-06-08T10:34:58.504+1000 [DEBUG] Attempting to open CLI config file: /home/n105659/.terraformrc
2022-06-08T10:34:58.504+1000 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2022-06-08T10:34:58.504+1000 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2022-06-08T10:34:58.504+1000 [DEBUG] ignoring non-existing provider search directory /home/n105659/.terraform.d/plugins
2022-06-08T10:34:58.504+1000 [DEBUG] ignoring non-existing provider search directory /home/n105659/.local/share/terraform/plugins
2022-06-08T10:34:58.504+1000 [DEBUG] ignoring non-existing provider search directory /usr/local/share/terraform/plugins
2022-06-08T10:34:58.504+1000 [DEBUG] ignoring non-existing provider search directory /usr/share/terraform/plugins
2022-06-08T10:34:58.504+1000 [INFO] CLI command args: []string{"apply"}
╷
│ Error: Argument or block definition required
│
│ on test01_20220608_8496.tf line 125, in resource "xenorchestra_vm" "test01":
│ 125: high_availability: "restart"
│
│ An argument or block definition is required here. To set an argument, use the equals sign "=" to introduce the argument value.
Here is a copy of the xenorchestra_vm configuration that was used:
memory_max = 8589934592
cpus = 4
cloud_config = xenorchestra_cloud_config.test01.template
name_label = "test01.xxxxxx"
name_description = "test01"
template = data.xenorchestra_template.test01template.id
high_availability: "restart"
Software versions: Terraform 1.2.1 Xenorchestra provider 0.23.0
Removing the high_availability argument allows the plan to proceed and it successfully builds the VM.
Cheers.
@whzzz28 please correct the syntax error and run that test again. You should use the following:
high_availability = "restart"
Sorry - typo in the first post. It was set to
high_availability = "restart"
I tried:
high_availability: "restart"
Which did not work. When using equals, it creates the VM, but Xen Orchestra showing HA: "Disabled"
Debug logs show this:
2022-06-08T13:44:54.342+1000 [WARN] Provider "provider[\"registry.terraform.io/terra-farm/xenorchestra\"]" produced an unexpected new value for xenorchestra_vm.cladevcma01, but we are tolerating it because it is using the legacy plugin SDK.
The following problems may be the cause of any confusing errors from downstream operations:
- .affinity_host: was null, but now cty.StringVal("")
- .resource_set: was null, but now cty.StringVal("")
- .high_availability: was cty.StringVal("restart"), but now cty.StringVal("")
- .disk[0].name_description: was null, but now cty.StringVal("")
- .disk[0].attached: was null, but now cty.True
- .network[0].attached: was null, but now cty.True
- .network[1].attached: was null, but now cty.True
- .network[2].attached: was null, but now cty.True
- .network[3].attached: was null, but now cty.True
xenorchestra_vm.cladevcma01: Creation complete after 6s [id=64e12c98-8e1a-b862-720d-1c05b723df2e]
2022-06-08T13:44:54.345+1000 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
2022-06-08T13:44:54.346+1000 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/terra-farm/xenorchestra/0.23.0/linux_amd64/terraform-provider-xenorchestra_v0.23.0 pid=11274
2022-06-08T13:44:54.346+1000 [DEBUG] provider: plugin exited
Apply complete! Resources: 2 added, 0 changed, 0 destroyed.
Some reason it is changing the string to ""
high_availability: was cty.StringVal("restart"), but now cty.StringVal("")
@whzzz28 please join the Discord mentioned in the README so we can debug this further. This back and forth is not a good use of a GitHub issue.
For now I'm going to close this issue. When we discuss this in Discord, we can follow up with a GitHub issues if it's necessary.
Hi.
Is there any examples of use of high_availability option that are known to work? Below is a sample resource I have been toying with, and terraform does not complain while applying, however in Xen Orchestra the VM created has a HA value of "Disabled". I believe i may be using this argument wrong. I also tried best-effort, with the same results. I was unable to find an example configuration with this argument.
resource "xenorchestra_vm" "testhost" { cpus = 4 memory_max = 589934592 cloud_config = xenorchestra_cloud_config.testhost.template name_label = "testhost" name_description = "A test" high_availability: "restart"
... }
Also reporting a typo on the terraform documentation site: http://registry.terraform.io/providers/terra-farm/xenorchestra/latest/docs/resources/vm#high_availabililty high_availabililty is spelt wrong.
Cheers.