sudo87 commented on issue #269:
URL:
https://github.com/apache/cloudstack-terraform-provider/issues/269#issuecomment-5251992254
@Diskoteket no problem.
I was able to reproduce the issue by forcing `http_get_only = true`
```
Error: Error registering user data: CloudStack API error 431
(CSExceptionErrorCode: 4350): User data is too long for http GET request
│
│ with cloudstack_user_data.repro,
│ on main.tf line 32, in resource "cloudstack_user_data" "repro":
│ 32: resource "cloudstack_user_data" "repro" {
│
```
It succeeded with with "http_get_only=false"
```
+ userdata_length_bytes = 7517
cloudstack_user_data.repro: Creating...
cloudstack_user_data.repro: Creation complete after 0s
[id=b8e79df7-d5dc-4911-a7c7-a44220500ad4]
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
```
test.tf
```
terraform {
required_providers {
cloudstack = {
source = "cloudstack/cloudstack"
version = "0.6.0"
}
random = {
source = "hashicorp/random"
}
}
}
# api_url / api_key / secret_key are read from the CLOUDSTACK_API_URL /
# CLOUDSTACK_API_KEY / CLOUDSTACK_SECRET_KEY env vars, so nothing sensitive
# needs to live in this file.
provider "cloudstack" {
http_get_only = var.http_get_only
}
variable "http_get_only" {
description = "Set true to reproduce issue #269 (userdata > 4096 bytes
fails over GET). Set false to confirm it works via POST."
type = bool
default = true
}
# Same size as the issue report (~7544 bytes) — comfortably over the
4096-byte
# GET limit, well under the POST limit (vm.userdata.max.length).
resource "random_id" "nonce" {
byte_length = 8
}
resource "cloudstack_user_data" "repro" {
name = "repro-269-${random_id.nonce.hex}"
userdata = "${random_id.nonce.hex}-${join("", [for i in range(750) :
"AAAAAAAAAA"])}"
}
output "userdata_length_bytes" {
value = length(cloudstack_user_data.repro.userdata)
}
```
--
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]