Diskoteket opened a new issue, #269:
URL: https://github.com/apache/cloudstack-terraform-provider/issues/269

   ### Affected Resources
   - resource "cloudstack_instance"
   - resource "cloudstack_user_data"
   
   ### Description
   I have deployed Apache Cloudstack and I want to create instances with 
userdata.
   My userdata is merely `7544 bytes` but when the provider tries to issue a 
GET method during orchestration the error code `4350` is thrown.
   
   I have tried pasting userdata in the webui and referencing on the instance 
but the same issue is thrown, see below.
   
   I have tried increasing the `vm.userdata.max.length` setting from `32768` to 
`1048576` , but it didn't help.
   
   **My userdata:**
   ```terraform
   output "user_data_size_bytes" {
     value = length(base64encode(local.my-vm_cloudinit))
   }
   ``` 
   
   ```bash
   Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
   
   Outputs:
   
   user_data_size_bytes = 7544
   ``` 
   
   I am not sure what the solution for this is since I have not delved into the 
code, but in the documentation there seems to be a [higher limit for POST 
method  in the 
API](https://docs.cloudstack.apache.org/en/4.22.0.0/adminguide/virtual_machines/user-data.html#storing-and-accessing-user-data),
 maybe this could solve this issue?
   
   > HTTP GET parameters are limited to a length of 2048 bytes, but it is 
possible to store larger User Data blobs by sending them in the body via HTTP 
POST instead of GET.
   
   
   ### Provider resource snippets
   
   
https://github.com/apache/cloudstack-terraform-provider/blob/16915b6926557720c001264cecdbe1c9caedd85c/cloudstack/resource_cloudstack_instance.go#L453
   
   
https://github.com/apache/cloudstack-terraform-provider/blob/16915b6926557720c001264cecdbe1c9caedd85c/cloudstack/resource_cloudstack_user_data.go#L91
   
   
   ### Debug output
   ```bash
   cloudstack_user_data.my-vm: Creating...
   ╷
   │ Error: Error registering user data: CloudStack API error 431 
(CSExceptionErrorCode: 4350): User data is too long for http GET request
   ``` 
   
   ```bash
   cloudstack_instance.my-vm: Creating...
   ╷
   │ Error: Error creating the new instance my-vm: CloudStack API error 431 
(CSExceptionErrorCode: 4350): User data is too long for http GET request
   ``` 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to