kislerdm / terraform-provider-neon

Terraform provider to manage Neon SaaS resources
https://registry.terraform.io/providers/kislerdm/neon/latest/docs
Mozilla Public License 2.0
28 stars 10 forks source link

Apply failed #32

Closed bxb100 closed 1 year ago

bxb100 commented 1 year ago

Terraform Version

Terraform v1.4.6 on darwin_arm64.

Provider Version

kislerdm/neon v0.1.0

Affected Resource(s)

Terraform Configuration Files

others same like example config^1

resource "neon_project" "this" {
  name      = var.app_name
  region_id = "aws-us-west-2"
}

Debug Output

│ Error: json: cannot unmarshal number 0.25 into Go struct field Endpoint.endpoints.autoscaling_limit_min_cu of type int32
│ 
│   with neon_project.this,
│   on main.tf line 33, in resource "neon_project" "this":
│   33: resource "neon_project" "this" {
│ 
╵
Releasing state lock. This may take a few moments...

Expected Behavior

pass

Actual Behavior

error

References

https://github.com/kislerdm/terraform-provider-neon/blob/ab8e6a3769e2feec48147513cae93b69c3fb984d/internal/provider/resource_endpoint.go#L65-L73

The API doc https://api-docs.neon.tech/reference/createproject set type is number, but for the free tier it seems to return 0.25

amaralc commented 1 year ago

Same thing here:

Acquiring state lock. This may take a few moments...
Releasing state lock. This may take a few moments...
╷
│ Error: Attribute must be a whole number, got 0.25
│ 
│   with module.neon-postgresql-dbms.neon_project.this,
│   on ../../iac-persistence/main.tf line 4, in resource "neon_project" "this":
│    4:   autoscaling_limit_max_cu = 0.25
│ 
╵
kislerdm commented 1 year ago

@bxb100 Hey! Thanks for opening the issue. I confirm that the root cause is the data type. Please feel free to open a PR with a fix. Otherwise, please allow me a couple of weeks to deliver a fix. Thanks!