You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Issue with Details in cloudstack_instance resource #148
but I get this error when I try to apply. I have tried several different ways and it still fails.
│ Error: Error creating the new instance test-box-0: invalid character '<' looking for beginning of value
│
│ with cloudstack_instance.test_box[0],
│ on main.tf line 46, in resource "cloudstack_instance" "test_box":
│ 46: resource "cloudstack_instance" "test_box" {
I'm running this agains the latest provider version 0.5.0 and on CS 4.19.1.0
@vishesh92 I see the most recent commit that is related to this, and was hoping you might have some insight as to why I'm not able to get this to work?
OK, I believe It has something to do with my firewall it is going through. If I go directly to the CS instance it will work.
HOWEVER: I went to change the memory to a value that is outside of the constrained offering, and it applied it in the TF with NO errors, and did not change anything in the actual cloudstack_instance resource. I would have expected this to return with an error like it does when the instance is being created with values outside the scope of the constrained resources.
Here is the change that should fail because my offering is only for a max of 4G of memory
but it showing it changed, but really didn't do anything to the instance
Still at only 4G of RAM
If I destroy that instance and re-run the TF with the 8G of RAM specified to create the instance it does fail.
Hi @CodeBleu sorry for the offtop, but I just wanted to know, how you managed to make details work.
When I specified custom compute service offering and then set details with proper values I got an error like:
│ Error: Error changing the service offering for instance worker: CloudStack API error 431 (CSExceptionErrorCode: 4350):
| Need to specify custom parameter values cpu, cpu speed and memory when using custom offering
│
│ with worker,
│ on modules/cloudstack/main.tf line 125, in resource "cloudstack_instance" "worker":
│ 125: resource "cloudstack_instance" "worker" {
│
╵
Terraform instance definition has details parameter set like this:
@chrxmvtik if you can use CloudMonkey ( cmk ) it would be helpful to see the other info that the UI doesn't show for the offering.
So far, nothing is standing out to me, but it would be helpful to see more detail on how the offering is setup. cmk list serviceofferings --filter name="g1.Custom"
Also, what Cloudstack Ver. are you running?
@chrxmvtik I just tested with an unconstrained offering and get the same error as you when trying to update an existing instance that had a different offering and was going to change it, but if you create the instance from scratch and specify the details, it will work!
I got the same error as you only when I initially tried to change the offering from constrained to unconstrained. If the instance is already using the unconstrained and I try to change the CPU (for example), then it will behave the same as constrained and show no issue it TF apply, but not actually change anything.
I still think this is an upstream issue with apache/cloudstack that needs to be resolved.
@chrxmvtik I just tested with an unconstrained offering and get the same error as you when trying to update an existing instance that had a different offering and was going to change it, but if you create the instance from scratch and specify the details, it will work!
I got the same error as you only when I initially tried to change the offering from constrained to unconstrained. If the instance is already using the unconstrained and I try to change the CPU (for example), then it will behave the same as constrained and show no issue it TF apply, but not actually change anything.
I still think this is an upstream issue with apache/cloudstack that needs to be resolved.
Ah yes, thanks! When I created a new instance with g1.Custom service offering then everything worked fine and I was able to define resources using details parameter. Seems like an workaround for a while..
@vishesh92 in regards to #158 , I have tested those changes, but still having issues.
Even thought it gives the error it actually applies the settings to state and another Plan will show no changes.
Also when purposely setting values not in the proper range it does not output from the plan/apply command that it's not in range, but gives the same error as above. It also, still applies those settings to state and another plan will come back clean.
Here is the logs from the management server:
2025-02-04 15:04:35,717 DEBUG [c.c.u.AccountManagerImpl] (qtp1789718525-741:ctx-85eea5a8 ctx-d3628ba6 ctx-afc6ef30) (logid:781668f2) Access to VM instance {"id":8428,"instanceName":"i-676-8428-VM","type":"User","uuid":"16eb8cbd-62b2-4b02-82fa-94cdefbc3da2"} granted to Account [{"accountName":"n8widgets","id":676,"uuid":"5216af48-d506-45f6-8cd3-873b5beb6e1f"}] by DomainChecker
2025-02-04 15:04:35,719 DEBUG [o.a.c.u.UserDataManagerImpl] (qtp1789718525-741:ctx-85eea5a8 ctx-d3628ba6 ctx-afc6ef30) (logid:781668f2) Null/empty base64 encoded user data set
2025-02-04 15:04:35,741 ERROR [c.c.a.ApiServer] (qtp1789718525-741:ctx-85eea5a8 ctx-d3628ba6 ctx-afc6ef30) (logid:781668f2) unhandled exception executing api command: [Ljava.lang.String;@255549e0
com.cloud.utils.exception.CloudRuntimeException: Failed to update VM, due to: Invalid memory value, specify a value between 1024 and 65536
at org.apache.cloudstack.api.command.user.vm.UpdateVMCmd.execute(UpdateVMCmd.java:287)
at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:172)
The error is saying it needs to be in the specified range or 1024 -> 65536 for memory, and as you can see it is using 4096
Activity
CodeBleu commentedon Dec 9, 2024
OK, I believe It has something to do with my firewall it is going through. If I go directly to the CS instance it will work.
HOWEVER: I went to change the memory to a value that is outside of the constrained offering, and it applied it in the TF with NO errors, and did not change anything in the actual
cloudstack_instanceresource. I would have expected this to return with an error like it does when the instance is being created with values outside the scope of the constrained resources.Here is the change that should fail because my offering is only for a max of 4G of memory

but it showing it changed, but really didn't do anything to the instance
Still at only 4G of RAM

If I destroy that instance and re-run the TF with the 8G of RAM specified to create the instance it does fail.

and it fails as expected.
chrxmvtik commentedon Dec 11, 2024
Hi @CodeBleu sorry for the offtop, but I just wanted to know, how you managed to make
detailswork.When I specified custom compute service offering and then set details with proper values I got an error like:
Terraform instance definition has details parameter set like this:
details = { cpuNumber = "8", cpuSpeed = "2000", memory = "6144" }There is basically no documentation how that should work, maybe any clues?
CodeBleu commentedon Dec 11, 2024
@chrxmvtik What version of TF and TF Cloudstack provider you using?
Any more info of your "custom offering" might be helpful too.
chrxmvtik commentedon Dec 11, 2024
Of course:
Terraform version: 1.10.1
Cloudstack terraform provider 0.5.0
Custom offering:

Custom offering details:
CodeBleu commentedon Dec 11, 2024
@chrxmvtik if you can use CloudMonkey ( cmk ) it would be helpful to see the other info that the UI doesn't show for the offering.
So far, nothing is standing out to me, but it would be helpful to see more detail on how the offering is setup.
cmk list serviceofferings --filter name="g1.Custom"Also, what Cloudstack Ver. are you running?
chrxmvtik commentedon Dec 11, 2024
Cloudstack version is 4.19.1.3
Here is result offering info from CMK:
Neither do I really see anything suspicious in here, tho.
CodeBleu commentedon Dec 11, 2024
linking this issue here as I think it's related
CodeBleu commentedon Dec 11, 2024
constrainedwithminandmaxsettings for CPU and RAM in my offering. Maybe this is a bug with theunconstrainedoffering?{ "count": 1, "serviceoffering": [ { "cacheMode": "none", "cpuspeed": 2600, "created": "2024-10-17T15:49:28+0000", "defaultuse": false, "diskofferingstrictness": false, "displaytext": "jwh-customed-constrained", "dynamicscalingenabled": true, "encryptroot": false, "hasannotations": false, "hosttags": "standard", "id": "c99c0b1a-ac09-4eb4-a05b-afe5192445d4", "iscustomized": true, "issystem": false, "isvolatile": false, "limitcpuuse": true, "name": "jwh-customed-constrained-2-8-2-4", "offerha": false, "provisioningtype": "thin", "rootdisksize": 0, "serviceofferingdetails": { "maxcpunumber": "8", "maxmemory": "4096", "mincpunumber": "2", "minmemory": "2048" }, "state": "Active", "storagetags": "standard_storage", "storagetype": "local" } ] }Maybe try using a custom
constrainedand limit the CPU and RAM like me to see if that works for you.CodeBleu commentedon Dec 11, 2024
@chrxmvtik I just tested with an
unconstrainedoffering and get the same error as you when trying to update an existing instance that had a different offering and was going to change it, but if you create the instance from scratch and specify thedetails, it will work!I got the same error as you only when I initially tried to change the offering from
constrainedtounconstrained. If the instance is already using theunconstrainedand I try to change the CPU (for example), then it will behave the same asconstrainedand show no issue it TF apply, but not actually change anything.I still think this is an upstream issue with apache/cloudstack that needs to be resolved.
chrxmvtik commentedon Dec 11, 2024
Ah yes, thanks! When I created a new instance with g1.Custom service offering then everything worked fine and I was able to define resources using details parameter. Seems like an workaround for a while..
vishesh92 commentedon Jan 24, 2025
@CodeBleu This issue looks like a duplicate of #58. I have created #158 to fix the update of details for a VM.
CodeBleu commentedon Feb 4, 2025
@vishesh92 in regards to #158 , I have tested those changes, but still having issues.
Even thought it gives the error it actually applies the settings to state and another Plan will show no changes.
Also when purposely setting values not in the proper range it does not output from the plan/apply command that it's not in range, but gives the same error as above. It also, still applies those settings to state and another plan will come back clean.
Here is the logs from the management server:
The error is saying it needs to be in the specified range or
1024 -> 65536formemory, and as you can see it is using4096