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
When attempting to create a Droplet using Terraform, an error occurs indicating that a number in the JSON response cannot be unmarshaled into a Go struct field of type int. This seems to be due to the ID number being larger than the maximum value for an int in Go.
Affected Resource(s)
digitalocean_droplet
Expected Behavior
The Droplet should be created successfully without any errors.
Actual Behavior
The Droplet is created but an error make terraform stopped.
╷
│ Error: Error creating droplet: json: cannot unmarshal number 2215418155 into Go struct field LinkAction.links.actions.id of type int
│
│ with digitalocean_droplet.app_net,
│ on do-droplets.tf line 1, in resource "digitalocean_droplet" "app_net":
│ 1: resource "digitalocean_droplet" "app_net" {
│
╵
The issue appears to be related to the JSON response from the DigitalOcean API containing an ID number that is too large for an int field in the Go struct. Since 2,215,418,155 ( 840C 992B ) > 2,147,483,647 ( 7FFF FFFF ) which is the max number of int32. The type of these large number field should be changed to uint32 or int64 instead of int32.
Important Factoids
No custom images or kernels are being used.
I am using Windows and found that this issue only occurs with the 386 (32-bit) version of Terraform, but not with the AMD64 (64-bit) version. You can download different versions of Terraform here.
I had the same issue and was able to resolve it by using the 64-bit executable as mentioned above. It is rather confusing that the 64-bit is called AMD.
Bug Report
Describe the bug
When attempting to create a Droplet using Terraform, an error occurs indicating that a number in the JSON response cannot be unmarshaled into a Go struct field of type
int
. This seems to be due to the ID number being larger than the maximum value for anint
in Go.Affected Resource(s)
Expected Behavior
The Droplet should be created successfully without any errors.
Actual Behavior
The Droplet is created but an error make terraform stopped.
Steps to Reproduce
terraform apply
.Terraform Configuration Files
Terraform version
Debug Output
Gist
Panic Output
No panic output.
Additional context
The issue appears to be related to the JSON response from the DigitalOcean API containing an ID number that is too large for an int field in the Go struct. Since
2,215,418,155 ( 840C 992B )
>2,147,483,647 ( 7FFF FFFF )
which is the max number ofint32
. The type of these large number field should be changed touint32
orint64
instead ofint32
.Important Factoids
No custom images or kernels are being used.
References
#151
The text was updated successfully, but these errors were encountered: